replaceText

Jim Ault jimaultwins at yahoo.com
Sun Jun 7 15:49:19 EDT 2009


Please note the difference in programming languages between a command  
and a function syntax.

Command
replace findWords with newWords in fld "fSTUFF"
--the original has been changed

Function
put replaceText(field "Stats",return,comma) into newTextBlock
--the original remains unchanged
--the new container has the modified version

put replaceText(field "Stats",return,comma) into field "Stats"
--the original has been changed

put replaceText(field "Stats",return,comma) into field "Stats"
--the original has all returns replaced by commas

Hope this helps

Jim Ault
Las Vegas


On Jun 7, 2009, at 12:41 PM, Richmond Mathewson wrote:

> Funnily enough I've nev r used this before . . .
>
> Tried your recipe and duplicated your error & more importantly:
>
> I know why . . .
>
> If you look in the Documentation under replaceText it shows this:
>
> replaceText(field "Stats",return,comma)
>
> while your
>
> replacetext(fld id 1004, findWords, replaceWords, newWords)
>
> has got more comma delimited items than the Doc example
>
> BLAST; still doesn't work . . .
>
> Although THIS DOES:
>
> on mouseUp
> put "Hello world" into fld id 1004  --you seem to have forgotten  
> this bit  :)
> put "Hello world" into findWords
> --put "Hello world" into replaceWords      what is this for ????????
> put "Another Day" into newWords
> if fld id 1004 contains findWords then
> replace findWords with newWords in fld "fSTUFF"
> end if
> end mouseUp
>
> so, frankly, I wouldn't lose any sleep over replaceText,
> although it does seem DUD.
>
>
> -= JB =- wrote:
>> The Rev dictionary shows the following two forms for replaceText,
>>
>> replacetext("malformed","mal","well") -- returns "wellformed"
>> replacetext(field "Stats",return,comma) -- makes comma-delimited
>>
>> Let's say I want to replace the text "Hello world" in fld id 1004  
>> with "Another Day"
>>
>> I put "Hello world" into findWords
>> I put "Hello world" into replaceWords
>> I put "Another Day" into newWords
>>
>> then I use the line below,
>>
>> replacetext(fld id 1004, findWords, replaceWords, newWords)
>>
>> I get an error.  One thing that is confusing is I am trying to use  
>> the 1st form of
>> replaceText which is,
>>
>> replacetext("malformed","mal","well")
>>
>> but this form does not designate the field the text to be replaced  
>> is in so
>> I added it like it is shown in the 2nd form of replaceText.
>>
>> What is the proper way to use replaceText since I keep getting an  
>> error?
>>
>> regards,
>> -=>JB<=-
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

Jim Ault
jimaultwins at yahoo.com





More information about the use-livecode mailing list