Text.ReplaceAll

From Xojo Documentation

Method

Text.ReplaceAll(find As Text, replacement As Text, Optional compareOptions As Integer = 0, Optional locale As Xojo.Core.Locale = Nil) As Text

Supported for all project types and targets.

Returns a new text value by replacing all instances of the find parameter’s value with the replacement parameter’s value. If the input does not contain the requested value, nothing is replaced and the input is returned.

Parameters

Value Description
find The text to find.
replacement The text to replace.
options (Optional) Use CompareCaseSensitive constant to have case-sensitive comparisons.
locale (Optional) Used to specify a Xojo.Core.Locale to use for the comparison.

Notes

By default this performs a case-insensitive comparison search. To do a case-sensitive comparison, supply the CompareCaseSensitive constant to the compareOptions parameter.

By default comparisons are done in an invariant locale (i.e. not dependent on the user's preferences). The locale parameter can be used to specify an explicit locale to do comparisons in.

Exceptions

Sample Code

Replaces all instances of "l" with "1":

Dim t As Text = "Hello, World!"

Dim newText As Text
newText = t.ReplaceAll("l", "L") ' newText = "HeLLo, WorLd!"