Function: string-trim

string-trim is a byte-compiled function defined in subr.el.gz.

Signature

(string-trim STRING &optional TRIM-LEFT TRIM-RIGHT)

Documentation

Trim STRING of leading and trailing strings matching TRIM-LEFT and TRIM-RIGHT.

TRIM-LEFT and TRIM-RIGHT default to "[ \\t\\n\\r]+".

Other relevant functions are documented in the string group.

View in manual

Probably introduced at or before Emacs version 24.4.

Shortdoc

;; string
(string-trim " foo ")
    => "foo"

Source Code

;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun string-trim (string &optional trim-left trim-right)
  "Trim STRING of leading and trailing strings matching TRIM-LEFT and TRIM-RIGHT.

TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"."
  (string-trim-left (string-trim-right string trim-right) trim-left))