Function: org-babel-chomp

org-babel-chomp is a byte-compiled function defined in ob-core.el.gz.

Signature

(org-babel-chomp STRING &optional REGEXP)

Documentation

Strip a trailing space or carriage return from STRING.

The default regexp used is "[ \\f\\t\\n\\r\\v]" but another one can be specified as the REGEXP argument.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ob-core.el.gz
(defun org-babel-chomp (string &optional regexp)
  "Strip a trailing space or carriage return from STRING.
The default regexp used is \"[ \\f\\t\\n\\r\\v]\" but another one
can be specified as the REGEXP argument."
  (let ((regexp (or regexp "[ \f\t\n\r\v]")))
    (while (and (> (length string) 0)
                (string-match regexp (substring string -1)))
      (setq string (substring string 0 -1)))
    string))