static unwrap()
Wrapper.unwrap()
Wrapper.unwrap()The method returns the given text without the given opening and closing chars.
public static unwrap(text: string, opening = '', closing = ''): string {
return (
(text = this.replaceClosing(text, closing, '')),
(text = this.replaceOpening(text, opening, '')),
text
);
}Parameters
text: string
text: stringThe text of the string from which given opening and closing chars are removed.
opening: string
opening: stringThe opening chars of the string to be removed in the given text.
closing: string
closing: stringThe closing chars of the string to be removed in the given text.
Returns
The return value is the given text of string type without the given opening and closing chars or unchanged text if it does not contain the given opening and closing chars.
Example usage
// Example usage.
import { Wrapper } from '@angular-package/wrapper';
const quote = new Wrapper('[', ']', 'quote');
// Returns quote of string.
Wrapper.unwrap(quote.valueOf(), '[', ']');
// Returns [quote] of string.
Wrapper.unwrap(quote.valueOf(), '[[', ']]');Last updated
Was this helpful?