Replace First Occurrence of a Substring in a String

Peter W A Wood peterwawood at gmail.com
Sun Sep 21 04:55:40 EDT 2014


Many thanks Thierry.

On 21 Sep 2014, at 16:40, Thierry Douez <th.douez at gmail.com> wrote:

> Peter,
> 
> 
>>        put "Cat and Dog" into tString
>>        repeat with tPos = 1 to the length of tString
>>                if char tPos of tString = "a" then
>>                        put "*" into char tPos of tString
>>                        exit repeat
>>                end if
>>        end repeat
>> 
> 
> How about this one?
> 
> 
>   get offset( "a", tString)
>   if IT > 0 then put "*" into char IT of tString
> 
> 
> Thierry
> 
> 
> ------------------------------------------------
> Thierry Douez - http://sunny-tdz.com
> Maker of sunnYperl - sunnYmidi - sunnYmage - sunnYpdf
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list