From Xojo Documentation


Replaces all occurrences of a string with another string.


result=sourceVariable.ReplaceAll(oldString, newString)

Part Type Description
result String A copy of sourceVariable with any changes made by the ReplaceAll function.
sourceVariable String The original string.
oldString String The characters to be replaced.
newString String The replacement characters.


The ReplaceAll function replaces all occurrences of oldString in sourceString with newString. ReplaceAll is case-insensitive.

If newString is an empty string (""), the ReplaceAll function deletes every occurrence of the oldString in the sourceString.

If oldString is an empty string (""), the ReplaceAll function returns an unchanged copy of the sourceString.


Below are some examples that show the results of the ReplaceAll function

Var result As String
Var source As String = "xyxyxy"
result = source.ReplaceAll("x", "z") // returns "zyzyzy"

source = "the quick fox"
result = source.ReplaceAll(" ", "") // returns "Thequickfox"
result = source.ReplaceAll(" ", ", ") // returns "The, Quick, Fox"

See Also

Replace, ReplaceLineEndings functions.