This module provides functions for string processing.
Returns a string, where
Returns a string consisting of
Returns the index of the first occurrence of
Concatenates
Returns a string containing
Returns the length of the maximum initial segment of
Example:
> string:cspan("\t abcdef", " \t").
0
Returns
Returns a string with the elements of
Example:
> join(["one", "two", "three"], ", ").
"one, two, three"
Returns
Example:
> string:left("Hello",10,$.).
"Hello....."
Returns the number of characters in
Returns the index of the last occurrence of
Returns
Example:
> string:right("Hello", 10, $.).
".....Hello"
Returns the position where the last occurrence of
Example:
> string:rstr(" Hello Hello World World ", "Hello World").
8
Returns the length of the maximum initial segment of
Example:
> string:span("\t abcdef", " \t").
5
Returns the position where the first occurrence of
Example:
> string:str(" Hello Hello World World ", "Hello World").
8
Returns a string, where leading and/or trailing blanks or a
number of
Example:
> string:strip("...Hello.....", both, $.).
"Hello"
Returns a substring of
Example:
sub_string("Hello World", 4, 8).
"lo Wo"
Returns a substring of
Example:
> substr("Hello World", 4, 5).
"lo Wo"
Returns the word in position
Example:
> string:sub_word(" Hello old boy !",3,$o).
"ld b"
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 specified string or character is case-converted. Notice that the supported character set is ISO/IEC 8859-1 (also called Latin 1); all values outside this set are unchanged
Returns a list of tokens in
Example:
> tokens("abc defxxghix jkl", "x ").
["abc", "def", "ghi", "jkl"]
Notice that, as shown in this example, two or more
adjacent separator characters in
Returns the number of words in
Example:
> words(" Hello old boy!", $o).
4
Some of the general string functions can seem to overlap each other. The reason is that this string package is the combination of two earlier packages and all functions of both packages have been retained.
Any undocumented functions in