<div class="meta" robots="noindex">

</div>

Method

# ReplaceAllB

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `String.ReplaceAllBytes<string.replaceallbytes>` as a replacement.

</div>

## Description

Replaces all occurrences of a `string</api/data_types/string>` with another `string</api/data_types/string>`.

## Usage

*result*=**ReplaceAllB**(*sourceString*, *oldString*, *newString*)

**OR**

*result*=*stringVariable*.**ReplaceAllB**(*oldString*, *newString*)

| Part           | Type                             | Description                                                                     |
|----------------|----------------------------------|---------------------------------------------------------------------------------|
| result         | `String</api/data_types/string>` | A copy of *sourceString* with any changes made by the **ReplaceAllB** function. |
| sourceString   | `String</api/data_types/string>` | The original string.                                                            |
| oldString      | `String</api/data_types/string>` | The characters to be replaced.                                                  |
| newString      | `String</api/data_types/string>` | The replacement characters.                                                     |
| stringVariable | `String</api/data_types/string>` | A `String</api/data_types/string>` variable containing the source string.       |

## Notes

The <span class="title-ref">ReplaceAllB</span> function replaces all occurrences of *oldString* in *sourceString* with *newString*. <span class="title-ref">ReplaceAllB</span> is case-sensitive because it treats the source string as a series of raw bytes.

If *newString* is an empty string (""), the <span class="title-ref">ReplaceAllB</span> function deletes every occurrence of the *oldString* in the *sourceString*.

If *oldString* is an empty string (""), the <span class="title-ref">ReplaceAllB</span> 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

``` xojo
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.replace>`, `String.ReplaceBytes<string.replacebytes>`, `String.ReplaceLineEndings<string.replacelineendings>` functions.
