ReplaceAllB

From Xojo Documentation

Method

Replaces all occurrences of a string with another string.

Syntax

result=ReplaceAllB(sourceString, oldString, newString)
OR
result=stringVariable.ReplaceAllB(oldString, newString) Introduced 5.0

Part Type Description
result String A copy of sourceString with any changes made by the ReplaceAllB function.
sourceString String The original string.
oldString String The characters to be replaced.
newString String The replacement characters.
stringVariable String A String variable containing the source string.

Notes

The ReplaceAllB function replaces all occurrences of oldString in sourceString with newString. ReplaceAllB is case-sensitive because it treats the source string as a series of raw bytes.

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

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

ReplaceAllB is case-sensitive; it treats sourceString as a series of raw bytes. It should be used instead of ReplaceAll when the string represents a series of bytes or when your application will run in a one-byte character set (such as the US system) and you want case-sensitivity.

Examples

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

Dim result As String
result = ReplaceAllB("xyxyxy", "x", "z") // returns "zyzyzy"
result = ReplaceAllB("The quick fox", " ", "") // returns "Thequickfox"
result = "The Quick Fox"
result = result.ReplaceAllB(" ", ", ") // returns "The, Quick, Fox"

See Also

Replace, ReplaceB, ReplaceAll, ReplaceLineEndings functions.