# unwrapText()

## `Wrapper.prototype.unwrapText()`

The method returns the [primitive value](https://wrapper.angular-package.dev/wrap/methods/instance/valueof) of a specified [`Wrapper`](https://wrapper.angular-package.dev/wrapper) object with [`text`](https://wrapper.angular-package.dev/wrap/accessors/text) unwrapped from the [`opening`](https://wrapper.angular-package.dev/wrap/accessors/opening) and [`closing`](https://wrapper.angular-package.dev/wrap/accessors/closing) chars of the [`Wrapper`](https://wrapper.angular-package.dev/wrapper) instance or given [`opening`](#opening-string) and [`closing`](#closing-string) chars.

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

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

{% endcode %}

### Parameters

#### `opening: string`

Optional opening chars of [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string) type to remove from the **beginning** of the [`text`](https://wrapper.angular-package.dev/wrap/accessors/text) of the [`Wrapper`](https://wrapper.angular-package.dev/wrapper) instance.

#### `closing: string`

Optional closing chars of [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string) type to remove from the **end** of the [`text`](https://wrapper.angular-package.dev/wrap/accessors/text) of the [`Wrapper`](https://wrapper.angular-package.dev/wrapper) instance.

### Returns

The **return value** is the [primitive value](https://wrapper.angular-package.dev/wrap/methods/instance/valueof) of [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string) type with [`text`](https://wrapper.angular-package.dev/wrap/accessors/text) unwrapped from the [`opening`](https://wrapper.angular-package.dev/wrap/accessors/opening) and [`closing`](https://wrapper.angular-package.dev/wrap/accessors/closing) chars of the [`Wrapper`](https://wrapper.angular-package.dev/wrapper) object or the 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.unwrapText();

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

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

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

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