Emacs Lisp: Trim String

By Xah Lee. Date: . Last updated: .

Emacs 24.4 New String Functions

Emacs 24.4 added many string functions. 〔►see Emacs 24.4 New Features (released 2014-10)

These are new string functions:

To use them, you need to first (require 'subr-x).

(require 'subr-x)
(string-trim " something  ") ; ⇒ "something"

Note: these functions are not documented and are kinda experimental. In the file header, it says it shouldn't be documented.

;; Do not document these functions in the lispref.
;; http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01006.html

See also: Emacs Lisp Problems: Trim String, Regex Match Data, Lacking Namespace

Like it? Buy Xah Emacs Tutorial. Thanks.

or, buy something from Best Keyboard for Emacs