# textUnwrap()

## `Wrapper.prototype.textUnwrap()`

The method returns the [`text`](/wrap/accessors/text.md) of the [`Wrapper`](/wrapper/overview.md) object without its [`opening`](/wrap/accessors/opening.md) and [`closing`](/wrap/accessors/closing.md) chars or the given [`opening`](#opening-string) and [`closing`](#closing-string) chars.

{% hint style="info" %}
The default values for the `opening` and `closing` parameters are taken from the `Wrapper` object.
{% endhint %}

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

```typescript
public textUnwrap(
  opening: string = this.opening,
  closing: string = this.closing
): string {
  return Wrapper.unwrap(this.text, opening, closing);
}
```

{% endcode %}

### Parameters

#### `opening: string`

Optional **opening** chars of [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type to remove from the **beginning** of the [`text`](/wrap/accessors/text.md) of the [`Wrapper`](/wrapper/overview.md) instance.

#### `closing: string`

Optional **closing** chars of [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type to remove from the **end** of the [`text`](/wrap/accessors/text.md) of the [`Wrapper`](/wrapper/overview.md) instance.

### Returns

The **return value** is the [`text`](/wrap/accessors/text.md) of [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type without the [`opening`](/wrap/accessors/opening.md) and [`closing`](/wrap/accessors/closing.md) chars of the [`Wrapper`](/wrapper/overview.md) object or given [`opening`](#opening-string) and [`closing`](#closing-string) 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.textUnwrap();

// Returns {This is a long text}.
longText.textUnwrap('', '');

// Returns This is a long text}.
longText.textUnwrap('{', '');

// Returns This is a long text.
longText.textUnwrap('{', undefined);

// Returns {This is a long text.
longText.textUnwrap('', '}');

// Returns This is a long text.
longText.textUnwrap(undefined, '}');
```


---

# 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/textunwrap.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.
