Method
ReplaceAllB
Warning
This item was deprecated in version 2019r2. Please use String.ReplaceAllBytes as a replacement.
Usage
result=ReplaceAllB(sourceString, oldString, newString)
OR
result=stringVariable.ReplaceAllB(oldString, newString)
Part |
Type |
Description |
---|---|---|
result |
A copy of sourceString with any changes made by the ReplaceAllB function. |
|
sourceString |
The original string. |
|
oldString |
The characters to be replaced. |
|
newString |
The replacement characters. |
|
stringVariable |
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.
Sample code
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"
Compatibility
All project types on all supported operating systems.
See also
String.Replace, String.ReplaceBytes, String.ReplaceLineEndings functions.