- ---------------------------------------- 
- -- replace in string 
- -- optionally replace with JS version based on RegExp 
- ---------------------------------------- 
- on str_replace (stringToFind, stringToInsert, input) 
-   output = "" 
-   findLen = stringToFind.length - 1 
-   repeat while true 
-     currOffset = offset(stringToFind, input) 
-     if currOffset=0 then exit repeat 
-     put input.char [1..currOffset] after output 
-     delete the last char of output 
-     put stringToInsert after output 
-     delete input.char [1.. (currOffset + findLen)]  
-   end repeat 
-   put input after output 
-   return output 
- end