Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
3cbfb935
Commit
3cbfb935
authored
Dec 20, 2013
by
Bozhidar Batsov
Browse files
* lisp/emacs-lisp/subr-x.el: (string-remove-prefix): New function.
(string-remove-suffix): New function.
parent
131e4695
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
0 deletions
+16
-0
etc/NEWS
etc/NEWS
+2
-0
lisp/ChangeLog
lisp/ChangeLog
+2
-0
lisp/emacs-lisp/subr-x.el
lisp/emacs-lisp/subr-x.el
+12
-0
No files found.
etc/NEWS
View file @
3cbfb935
...
...
@@ -885,6 +885,8 @@ frame.
***
`string-trim-left'
***
`string-trim-right'
***
`string-trim'
***
`string-remove-prefix'
***
`string-remove-suffix'
** Obsoleted functions:
***
`log10'
...
...
lisp/ChangeLog
View file @
3cbfb935
...
...
@@ -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 <rudalics@gmx.at>
...
...
lisp/emacs-lisp/subr-x.el
View file @
3cbfb935
...
...
@@ -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
))
string
))
(
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
)))
string
))
(
provide
'subr-x
)
;;; subr-x.el ends here
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment