# string.replace-multiple()

The `string.replace-multiple()` function handles multiple string replaces, using [`string.replace()`](/sass/string/string.replace.md) function.

{% code lineNumbers="true" %}

```scss
// Modules.
@use 'string.replace.function';

// The `string.replace-multiple()` function.
@function replace-multiple($string, $replaces...) {
  @each $occurrence, $substring, $replacement in $replaces {
    $string: string.replace($string, $occurrence, $substring, $replacement);
  }
  @return $string;
}
```

{% endcode %}

{% embed url="<https://github.com/angular-package/sass/blob/main/string/_string.replace-multiple.function.scss>" %}
string.multiple-replaces()
{% endembed %}

### Parameters

#### **`$string`**

The string to do multiple [`$replaces`](#usdreplaces...).

#### `$replaces...`

Arbitrary replaces (occurrence, substring, replacement) to do on [`$string`](#usdstring).

### Return

The return value is a `string` with done [`$replaces`](#usdreplaces...).

## Examples

```scss
// Use.
@use '@angular-package/sass/string';

// Examples.
// single replacement first occurrence
@debug string.replace-multiple('bold king is hairy', first 'bold' 'baloon'); // baloon king is hairy
@debug string.replace-multiple('bold king is hairy', first 'bold' ''); //  king is  hairy
@debug string.replace-multiple(':==', first ':' '');

// single replacement all occurrences
@debug string.replace-multiple('bold king is bold hairy', all 'bold' ''); //  king is  hairy
@debug string.replace-multiple('bold king is bold hairy', all 'bold' 'test'); // test king is test hairy

// multiple replacements
@debug string.replace-multiple('bold king is hairy', first (bold is) ''); //  king  hairy
@debug string.replace-multiple('bold king is hairy', first bold baloon, first king baloon); // baloon baloon is hairy
@debug string.replace-multiple('bold king is hairy', first (bold king) baloon, first (is hairy) bold); // baloon baloon bold bold
@debug string.replace-multiple('atmosphere bold bold bold king is hairy', first (king bold) baloon); // atmosphere baloon bold bold baloon is hairy
@debug string.replace-multiple('atmosphere bold bold bold king is hairy', all (king bold) baloon); // atmosphere baloon baloon baloon baloon is hairy

// multiple replacements different occurrences
@debug string.replace-multiple('atmosphere bold bold bold king is hairy', first bold clean, all (king bold) baloon); // atmosphere clean baloon baloon baloon is hairy

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.angular-package.dev/sass/string/string.replace-multiple.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
