Returns the inputString with the occurences of findString replaced by replaceString. Optionally you can give a start position and the maximum number of replacements.
Replace( x, y, z ) Replace( x, y, z, w ) Replace( x, y, z, w, q ) Replace( x, y, z, w, q, r )
x | The string to replace occurences for |
---|---|
y | The part of the input string to be replaced |
z | The string to replace y in x |
w | The index of the place to start replacing in the input string [OPTIONAL, default 0] |
q | The maximum number of times to replace the string, -1 to never stop [OPTIONAL, default -1] |
r | Whether or not to look case-sensitive - 0 if case-sensitive, 1 if not [OPTIONAL, default 0] |
String
replace("abc","b","d") // Returns "adc" replace("abcdefabc","b","d") // Returns "adcdefadc" replace("abc","b","d",2) // Returns "abc" replace("abcdefabc","b","d",2) // Returns "abcdefadc" replace("abcdefabcdefabc","b","d",2,1) // Returns "abcdefadcdefabc" replace("ABCdefabc","b","d",1,1,1) // Returns "AdCdefadc"