Strings.strip()

Syntax

function strip(from: string, ...what: string[]): string

Returns a new string with all the specified tokens removed.

Parameters
from

The string to strip.

what Rest

The tokens to remove from from if found. If not specified, the function will return the original string.

Example

import { Strings } from 'potence';

const string = 'T&hi%s i$s a !string w&ith str!ange ch$aracters in it.';

Strings.strip(string, '%' '!', '&', '$');
// -> 'This is a string with strange characters in it.'

Remarks

This function removes all occurrences of the tokens specified by what, not just the first one.