Hmm, let me see if I understand you correctly:
On 13/06/2012, at 7:19 PM, Richmond wrote:
> put fld "TEXXT" into TEXXT
> if TEXXT contains "sugar" then
> replaceText ("sugar","sugar","sweetener")
> end if
> put TEXXT into fld "TEXXT"
>
> doesn't work.
So, in this example, are you trying to replace the word "sugar" with the word
"sweetener" inside field "TEXXT"?
If that is the case, I believe you should be able to do it with a single line:
replace "sugar" with "sweetener" in field "TEXXT"
In any case, the dictionary states, that the 'replaceText' function RETURNS the
changed string - so my guess is that you have to 'put' the returned value
somewhere, like this:
put field "TEXXT" into TEXXT
put TEXXT into newTEXXT
if TEXXT contains "sugar" then put replaceText(TEXXT, "sugar", "sweetener")
into newTEXXT
put newTEXXT into field "TEXXT"
That should work, but it will be a lot more convoluted - and slower - than
doing the single-line 'replace'!
I hope this helps!
--
Igor Couto
Sydney, Australia
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode