# replaceClosingIn()

## `Wrapper.prototype.replaceClosingIn()`

Replaces the [`closing`](https://wrapper.angular-package.dev/wrap/accessors/closing) chars of the [`Wrapper`](https://wrapper.angular-package.dev/wrapper/overview) object in the given [`text`](#text-string) with a given [replacement value](#replacevalue-string).

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

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

```typescript
public replaceClosingIn(text: string, replaceValue: string): string {
  return Wrapper.replaceClosing(text, this.closing, replaceValue);
}
```

{% endcode %}

### Parameters

#### `text: string`

The **text** of [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type in which the [`closing`](https://wrapper.angular-package.dev/wrap/accessors/closing) chars are replaced by given [replacement value](#replacevalue-string).

#### `replaceValue: string`

The value of [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type as a replacement for the [`closing`](https://wrapper.angular-package.dev/wrap/accessors/closing) chars at the **end** of the given [`text`](#text-string).

### Returns

The **return value** is the given text of [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type with replaced [`closing`](https://wrapper.angular-package.dev/wrap/accessors/closing) chars by given [replacement value](#replacevalue-string).

## Example usage

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

const longText = new Wrapper('{{', '}}', 'This is a long text');
const text = `Lorem ipsum and more`;

// Returns Lorem ipsum and more??.
longText.replaceClosingIn(`${text}${longText.closing}`, '??');

// Returns }}Lorem ipsum and more.
longText.replaceClosingIn(`${longText.closing}${text}`, '??');
```


---

# 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://wrapper.angular-package.dev/wrapper/methods/instance/replaceclosingin.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.
