> For the complete documentation index, see [llms.txt](https://docs.angular-package.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.angular-package.dev/wrapper/wrapper/methods/instance/textreplaceopening.md).

# textReplaceOpening()

## `Wrapper.prototype.textReplaceOpening()`

Replaces the [`opening`](/wrapper/wrap/accessors/opening.md) chars of the [`Wrapper`](/wrapper/wrapper/overview.md) object in the [`text`](/wrapper/wrap/accessors/text.md) of the [`Wrapper`](/wrapper/wrapper/overview.md) object with the given [`opening`](#opening-string) chars.

{% hint style="info" %}
The replacement succeeds if the opening characters exist at the beginning of the text.
{% endhint %}

{% code title="wrapper.class.ts" %}

```typescript
public textReplaceOpening(opening: string): string {
  return Wrapper.replaceOpening(this.text, this.opening, opening);
}
```

{% endcode %}

### Parameters

#### `opening: string`

The **opening** chars of [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) to replace in the [`text`](/wrapper/wrap/accessors/text.md)(part of the primitive value).

### Returns

The **return value** is the [`text`](/wrapper/wrap/accessors/text.md) of [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type with replaced [`opening`](/wrapper/wrap/accessors/opening.md) chars.

## Example usage

```typescript
// Example usage.
import { Wrapper } from '@angular-package/wrapper';

const longText = new Wrapper('{', '}', '{This is a long text}');

// Returns {{This is a long text}}.
longText.valueOf();

// Returns This is a long text}.
longText.textReplaceOpening('');

// Returns {{This is a long text}.
longText.textReplaceOpening('{{');
```
