Function: org-trim

org-trim is a byte-compiled function defined in org-macs.el.gz.

Signature

(org-trim S &optional KEEP-LEAD)

Documentation

Remove whitespace at the beginning and the end of string S.

When optional argument KEEP-LEAD is non-nil, removing blank lines at the beginning of the string does not affect leading indentation.

Aliases

org-babel-trim (obsolete since 9.0)

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-macs.el.gz
(defsubst org-trim (s &optional keep-lead)
  "Remove whitespace at the beginning and the end of string S.
When optional argument KEEP-LEAD is non-nil, removing blank lines
at the beginning of the string does not affect leading indentation."
  (replace-regexp-in-string
   (if keep-lead "\\`\\([ \t]*\n\\)+" "\\`[ \t\n\r]+") ""
   (replace-regexp-in-string "[ \t\n\r]+\\'" "" s)))