Removes trailing whitespace or specified characters from a string.
The string from which trailing characters will be trimmed.
Optional
The character(s) to remove from the end of the string.
const trimmedStr1 = trimEnd('hello---', '-') // returns 'hello'const trimmedStr2 = trimEnd('123000', '0') // returns '123'const trimmedStr3 = trimEnd('abcabcabc', 'c') // returns 'abcabcab'const trimmedStr4 = trimEnd('trimmedxxx', 'x') // returns 'trimmed' Copy
const trimmedStr1 = trimEnd('hello---', '-') // returns 'hello'const trimmedStr2 = trimEnd('123000', '0') // returns '123'const trimmedStr3 = trimEnd('abcabcabc', 'c') // returns 'abcabcab'const trimmedStr4 = trimEnd('trimmedxxx', 'x') // returns 'trimmed'
Alias