Removes given characters from both sides of the string. If you want to remove from one side of the string see trimStart and trimEnd.
trim("abcb", "ab"); // "cb"trim("!aaa!", "!"); // "aaa"trim("!aaa!!!", "!"); // "aaa"trim("!aaa!!!", "!!!"); // "!aaa" Copy
trim("abcb", "ab"); // "cb"trim("!aaa!", "!"); // "aaa"trim("!aaa!!!", "!"); // "aaa"trim("!aaa!!!", "!!!"); // "!aaa"
Source string.
Characters to remove, taken as a whole.
Removes given characters from both sides of the string. If you want to remove from one side of the string see trimStart and trimEnd.
Example