> For the complete documentation index, see [llms.txt](https://wrapper.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://wrapper.angular-package.dev/wrap/methods/instance/replaceopening.md).

# ★ replaceOpening()

## `Wrap.prototype.replaceOpening()`

Returns the [primitive value](/wrap/methods/instance/valueof.md) with replaced [`opening`](/wrap/accessors/opening.md) chars.

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

```typescript
public replaceOpening<ReplaceOpening extends string = ''>(
  opening: ReplaceOpening
): `${ReplaceOpening}${Text}${Closing}` {
  return `${opening}${this.#text}${this.#closing}`;
}
```

{% endcode %}

### Generic type variables

#### <mark style="color:green;">**`ReplaceOpening`**</mark>**`extends`**<mark style="color:green;">**`string`**</mark>**`=`**<mark style="color:green;">**`''`**</mark>

A generic type variable constrained by the [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string), by default of the value captured from the provided [`opening`](#opening-replaceopening) indicates the `ReplaceOpening` type on the template of the [return type](#return-type).

### Parameters

#### `opening: ReplaceOpening`

The opening chars of a generic type variable [`ReplaceOpening`](#replaceopeningextendsstring) to replace the [`opening`](/wrap/accessors/opening.md) chars in the [primitive value](/wrap/methods/instance/valueof.md).

### Return type

#### `${ReplaceOpening}${Text}${Closing}`

The **return type** is the [template literal](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html) of generic type variables in order [`ReplaceOpening`](#replaceopeningextendsstring), [`Text`](https://wrapper.angular-package.dev/wrap/methods/instance/pages/SYPkCWCkQnshiX32nwLt#wrap-less-than...-text-...greater-than) and [`Closing`](/wrap/generic-type-variables.md#wrap-closing).

### Returns

The **return value** is the [primitive value](/wrap/methods/instance/valueof.md) with replaced [`opening`](/wrap/accessors/opening.md) chars of a generic type variables in order [`ReplaceOpening`](#replaceopeningextendsstring), [`Text`](https://wrapper.angular-package.dev/wrap/methods/instance/pages/SYPkCWCkQnshiX32nwLt#wrap-less-than...-text-...greater-than) and [`Closing`](/wrap/generic-type-variables.md#wrap-closing) on the template.

## Example usage

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

// Returns {{quote] of type "{{quote]".
new Wrap(`[`, `]`, 'quote').replaceOpening('{{');

// Returns {{quote] of "{{quote]".
new Wrap(``, `]`, 'quote').replaceOpening('{{');

// Returns <quote] of "<quote]".
new Wrap(``, `]`, 'quote').replaceOpening('<');
```
