Commit 3cbfb935 authored by Bozhidar Batsov's avatar Bozhidar Batsov
Browse files

* lisp/emacs-lisp/subr-x.el: (string-remove-prefix): New function.

(string-remove-suffix): New function.
parent 131e4695
......@@ -885,6 +885,8 @@ frame.
*** `string-trim-left'
*** `string-trim-right'
*** `string-trim'
*** `string-remove-prefix'
*** `string-remove-suffix'
** Obsoleted functions:
*** `log10'
......@@ -2,6 +2,8 @@
* emacs-lisp/subr-x.el: Renamed from helpers.el.
helpers.el was a poor choice of name.
(string-remove-prefix): New function.
(string-remove-suffix): New function.
2013-12-20 Martin Rudalics <>
......@@ -73,6 +73,18 @@
"Check whether STRING is either empty or only whitespace."
(string-match-p "\\`[ \t\n\r]*\\'" string))
(defsubst string-remove-prefix (prefix string)
"Remove PREFIX from STRING if present."
(if (string-prefix-p prefix string)
(substring string (length prefix))
(defsubst string-remove-suffix (suffix string)
"Remove SUFFIX from STRING if present."
(if (string-suffix-p suffix string)
(substring string 0 (- (length string) (length suffix)))
(provide 'subr-x)
;;; subr-x.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment