There must be an easy way to replace only the first occurrence of a substring 
within a string. The replaceText function replaces all occurrences of a string 
which matches the the supplied substring (actually the supplied regular 
expression).

Obviously, it can be done with a loop, something like this:

        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

If there isn't an easier way, I'm sure many of you know a better way.

Regards

Peter
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to