This module contains functions for string processing.
Returns the number of characters in the string.
Tests whether two strings are equal. Returns
Concatenates two strings to form a new string. Returns the new string.
Returns the index of the first/last occurrence of
Returns the position where the first/last occurrence of
> string:str(" Hello Hello World World ", "Hello World").
8
Returns the length of the maximum initial segment of String, which consists entirely of characters from (not from) Chars.
For example:
> string:span("\t abcdef", " \t").
5
> string:cspan("\t abcdef", " \t").
0
Returns a substring of
For example:
> substr("Hello World", 4, 5).
"lo Wo"
Returns a list of tokens in
For example:
> tokens("abc defxxghix jkl", "x ").
["abc", "def", "ghi", "jkl"]
Returns a string with the elements of
For example:
> join(["one", "two", "three"], ", ").
"one, two, three"
Returns a string consisting of
Returns a string containing
Returns the number of words in
For example:
> words(" Hello old boy!", $o).
4
Returns the word in position
For example:
> string:sub_word(" Hello old boy !",3,$o).
"ld b"
Returns a string, where leading and/or trailing blanks or a
number of
For example:
> string:strip("...Hello.....", both, $.).
"Hello"
Returns the
For example:
> string:left("Hello",10,$.).
"Hello....."
Returns the
For example:
> string:right("Hello", 10, $.).
".....Hello"
Returns a string, where
Returns a substring of
For example:
sub_string("Hello World", 4, 8).
"lo Wo"
Argument
Example:
> {F1,Fs} = string:to_float("1.0-1.0e-1"),
> {F2,[]} = string:to_float(Fs),
> F1+F2.
0.9
> string:to_float("3/2=1.5").
{error,no_float}
> string:to_float("-1.5eX").
{-1.5,"eX"}
Argument
Example:
> {I1,Is} = string:to_integer("33+22"),
> {I2,[]} = string:to_integer(Is),
> I1-I2.
11
> string:to_integer("0.5").
{0,".5"}
> string:to_integer("x=2").
{error,no_integer}
The given string or character is case-converted. Note that the supported character set is ISO/IEC 8859-1 (a.k.a. Latin 1), all values outside this set is unchanged
Some of the general string functions may seem to overlap each other. The reason for this is that this string package is the combination of two earlier packages and all the functions of both packages have been retained.
Any undocumented functions in