Replace First Occurrence of a Substring in a String

Thierry Douez th.douez at gmail.com
Sun Sep 21 04:45:14 EDT 2014


a bit more generic...

on mouseUp
   put "Cat and Dog" into tString

   put "and" into tPattern
   put the length of tPattern -1 into tLengh

   get offset( tPattern, tString)
   if IT > 0 then put "*" into char IT to ( IT + tLengh) of tString
   put tString
end mouseUp



Thierry


------------------------------------------------
Thierry Douez - http://sunny-tdz.com
Maker of sunnYperl - sunnYmidi - sunnYmage




More information about the use-livecode mailing list