Go to the first, previous, next, last section, table of contents.

String functions

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)
This function tries to be a string near-equivalent to the elisp function 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:
\&
\& stands for the entire text being replaced.
\n
\n stands for the nth subexpression in the original regexp. Subexpressions are those expressions grouped inside of \(...\). n is a digit.
\\
\\ stands for a single \ in newtext.
Any other character after the \ will just be copied into the string.
(string-split pattern string &optional limit)
Split the string string on the regexp pattern and return a list of the strings between the matches. If the optional numerical argument limit is >= 1, only the first limit elements of the list are returned. For example, the call
(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").

Go to the first, previous, next, last section, table of contents.