The long lost Emacs string manipulation library.
M-x package-install s
Or you can just dump
s.el in your load path somewhere.
[[ function-list ]]
Documentation and examples
[[ function-docs ]]
What's with the built-in wrappers?
Imagine looking through the function list and seeing
s-starts-with? is nowhere to be found. Why? Well, because Emacs already has
string-prefix-p. Now you're starting out slightly confused, then have to go
somewhere else to dig for the command you were looking for.
The wrapping functions serve as both documentation for existing functions and makes for a consistent API.
Other string related libraries
inflections package provides functions for strings pluralization and singularization.
levenshtein package provides a function to calculate the Levenshtein distance between two strings.
string-utils is another general string manipulation library.
From 1.8.0 to 1.9.0
From 1.7.0 to 1.8.0
- Better handling of international characters
From 1.6.0 to 1.7.0
- Better handling of camel cased strings (@Bruce-Connor)
From 1.5.0 to 1.6.0
- Bugfixes for
From 1.4.0 to 1.5.0
From 1.3.1 to 1.4.0
s-less?predicate (Rüdiger Sonderfeld)
- Add START parameter to
From 1.3.0 to 1.3.1
- Move .el files out of root to avoid problems with require.
From 1.2.1 to 1.3.0
s-capitalizenow converts the first word's first character to upper case and the rest to lower case.
s-titleizeworks like the old
s-capitalizeand capitalizes each word. (Johan Andersson)
s-titleized-wordsmirror this change.
Arthur Andersen contributed
Johan Andersson contributed
Nic Ferrier added
Rüdiger Sonderfeld contributed
s-splitand several bugfixes.
Geoff Gole contributed
Sylvain Rousseau contributed
Lars Andersen contributed
Yes, please do. Pure functions in the string manipulation realm only,
please. There's a suite of tests in
dev/examples.el, so remember to add
tests for your function, or I might break it later.
You'll find the repo at:
Run the tests with
Create the docs with
I highly recommend that you install these as a pre-commit hook, so that the tests are always running and the docs are always in sync:
cp pre-commit.sh .git/hooks/pre-commit
Oh, and don't edit
README.md directly, it is auto-generated.
Copyright (C) 2012 Magnar Sveen
Authors: Magnar Sveen firstname.lastname@example.org Keywords: strings
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.