To use the string functions in Elib you have to put the following line into your elisp source file:
(require 'string)
The following string functions are provided with Elib.
(string-replace-match regexp string newtext &optional literal global)
replace-match
. It returns a string with the first text matched
by regexp in string replaced by newtext. If no match
is found, nil
is returned. If optional argument global is
non-nil
, all occurances matching regexp are replaced
instead of only the first one.
If optional argument literal is non-nil
, then newtext
is inserted exactly as it is. If it is nil
(which is the
default), then the character \ is treated specially. If a \
appears in newtext, it can start any one of the following sequences:
\(...\)
.
n is a digit.
(string-split pattern string &optional limit)
(string-split "[ \t]+" "Elisp programming is fun.")will return
("Elisp" "programming" "is" "fun.")
, but the call
(string-split " " "Elisp programming is fun." 3)will return
("Elisp" "programming" "is")
.