string.replace

Syntax string.replace (s, searchfor, replacewith, flCaseSensitive = true)

Params s is the string in which the replacement should occur.

searchfor is the string of characters to be replaced.

replacewith is the string of characters to replace searchfor.

flCaseSensitive is an optional boolean determining whether the search should be case-sensitive. Default: True.

Action Locates searchfor in s and replaces it entirely with replacewith.

Returns The new string. If replacewith is not found in s, then s is returned unchanged.

Examples string.replace ("abcdefghijklm", "fgh", "12345")

   » abcde12345ijklm

string.replace ("abcdefghijklm", "xxx", "12345")

   » abcdefghijklm // "xxx" not found, so string is unchanged.

Notes This verb only replaces the first occurrence of the searchfor; if you want to replace all occurrences, use string.replaceAll.

See Also string.replaceAll

search.replace

string.multipleReplaceAll

string.patternMatch

Discuss