Trims the specified characters from the end of the string.
Use the native trimEnd method if you want to trim whitespace.