adding string manipulation functions to org-babel.el
This commit is contained in:
parent
2081b95410
commit
9040ad657b
|
@ -359,6 +359,9 @@ This is taken almost directly from `org-read-prop'."
|
|||
"Return t if STRING represents a number"
|
||||
(string-match "^[[:digit:]]*\\.?[[:digit:]]*$" string))
|
||||
|
||||
(defun org-babel-reverse-string (string)
|
||||
(apply 'string (reverse (string-to-list string))))
|
||||
|
||||
(defun org-babel-chomp (string &optional regexp)
|
||||
"Remove any trailing space or carriage returns characters from
|
||||
STRING. Default regexp used is \"[ \f\t\n\r\v]\" but can be
|
||||
|
@ -367,5 +370,10 @@ overwritten by specifying a regexp as a second argument."
|
|||
(setq string (substring string 0 -1)))
|
||||
string)
|
||||
|
||||
(defun org-babel-trim (string &optional regexp)
|
||||
"Like `org-babel-chomp' only it runs on both the front and back of the string"
|
||||
(org-babel-chomp (org-babel-reverse-string
|
||||
(org-babel-chomp (org-babel-reverse-string string) regexp)) regexp))
|
||||
|
||||
(provide 'org-babel)
|
||||
;;; org-babel.el ends here
|
||||
|
|
Loading…
Reference in New Issue