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

This function is valid in v2.0.0 to v2.13.1. This function has been downloaded 27 times.


{string=} opt_str Optional, Default:undefined
The string to return with all whitespace characters or specified characters stripped from the beginning 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 beginning of the string.


If opt_str is not given a function will be returned that will take one string argument and trim the beginning of that string using the characters from opt_chars. If opt_str is given it will be returned with all leading 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.