.. efun:: string trim(string s) string trim(string s, int where) string trim(string s, int where, int ch) string trim(string s, int where, string ch) :include: Remove all leading and trailing characters :arg:`ch` from the string :arg:`s` and return the new string. :arg:`ch` may be given as a single character, or a string of characters. If :arg:`ch` is not given, it defaults to the whitespace ``" \t"``. :arg:`where` can be used to modify where the characters are removed: :macro:`TRIM_LEFT` (1): remove the leading characters :macro:`TRIM_RIGHT` (2): remove the trailing characters :macro:`TRIM_BOTH` (3 or 0): remove both leading and trailing characters .. usage:: :: trim(" 1234 ") --> "1234" trim(" 1234 ", TRIM_RIGHT) --> " 1234" trim(" 1234 ", TRIM_BOTH, " 1") --> "234" :history 3.2.7 introduced: .. seealso:: :efun:`regreplace`