how do you replace the first occurence of string a in string b with string c?
Replacing the first occurence of string a in string b with string c
There are lots of ways to do this. Here is a particularly inelegant way:
set the_string to "It is off of the hizzle, fo'chizzle, dizzle." set search_string to "izzle" set replace_string to "elzzi" set the_offset to offset of search_string in the_string set the_string to (text 1 thru (the_offset - 1) of the_string) & replace_string & (text (the_offset + (count of search_string)) thru -1 of the_string) --> "It is off of the helzzi, fo'chizzle, dizzle."
thx very much i knew you can do something like that just didnt know the syntax again thx but will that work for every search string or just the first (i need it for just the first)?