Removes all whitespace characters or the specified characters from the end of a string.

This function is valid in v2.0.0 to v2.20.0. This function has been downloaded 22 times.


{string=} opt_str Optional
The string to return with all whitespace characters or specified characters stripped from the end of it.
{string=} opt_chars Optional, Default:"\t\n\v\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF"
Characters to remove from the end of the string.


If opt_str is not given a function will be returned that will take one string argument and trim the end of that string using the characters from opt_chars. If opt_str is given it will be returned with all trailing characters found in opt_chars stripped off.

Required Function

This function requires the following function which is included automatically:

  • quoteRegExp()
    Turn any string into a regular expression that matches the exact string without worrying about encoding the metacharacters yourself.