Module ce_string
Description
String library.Function Index
| Exported Functions | |
|---|---|
| caps/1 | See caps/2. |
| caps/2 | Capitalizes each letter that is not preceded by a letter. |
| chomp/1 | Removes all newlines from the end of a string. |
| columns/2 | Translates string into list of strings by columns. |
| extract/2 | Extracts a field at a given location from a string. |
| extract/3 | Extracts a field at a given location with a given width. |
| fields/3 | Translates string into list of strings by fields. |
| join/2 | Joins strings with a delimeter between each part. |
| join/3 | Joins strings with a delimeter between each part and a second delimeter between the last two parts. |
| keyvalue/1 | See keyvalue/2. |
| keyvalue/2 | Gets the key and value from a line of text. |
| lc/1 | Translates a string to lowercase. |
| pad/2 | Pads a string to a given width in characters. |
| pad/3 | Pads a string to a given width in characters. |
| quote_regexp/1 | Inserts escape chars into string to make it a literal regexp. |
| remove_eol/1 | Removes a single newline from the end of a string. |
| split/2 | Splits a string on each occurance of a delimeter. |
| strip_quotes/1 | See strip_quotes/2. |
| strip_quotes/2 | Strips leading and trailing quotes from a string. |
| uc/1 | Translates a string to uppercase. |
| Internal Documented Functions | |
| unescape/1 | Unescapes backslash-escaped sequences in a string. |
Exported Functions
caps/1
caps(string() | atom()) -> string()
Equivalent to caps(String, {$\s, $\s}).
caps/2
caps(string() | atom(), {char(), char()}) -> string()
Capitalizes each letter that is not preceded by a letter. Also translates one character to another, typically for turning underscores into hyphens or spaces for human-readability.
chomp/1
chomp(string()) -> string()
Removes all newlines from the end of a string. Should work on both 'nix and MS-DOS newlines.
columns/2
columns(string(), schema()) -> [string()]
Translates string into list of strings by columns.
e.g. columns("1234567890", [{2,3},{8,2}]) -> ["234", "89"]
extract/2
extract(string(), integer()) -> string()
Extracts a field at a given location from a string. Returns the field with spaces stripped off.
extract/3
extract(string(), integer(), integer()) -> string()
Extracts a field at a given location with a given width. Returns the field with spaces stripped off.
fields/3
fields(string(), string(), string()) -> [string()]
Translates string into list of strings by fields.
e.g. fields("a,'b,c',d", ",", "'") -> ["a","b,c","d"]
join/2
join(string(), [string()]) -> string()
Joins strings with a delimeter between each part.
join/3
join(string(), string(), [string()]) -> string()
Joins strings with a delimeter between each part
and a second delimeter between the last two parts.
e.g. join(", ", ", and ", ["A","B","C"]) -> "A, B, and C"
keyvalue/1
keyvalue(string()) -> {string(), string()}
Equivalent to keyvalue(string(), ":").
keyvalue/2
keyvalue(string(), string()) -> {string(), string()}
Gets the key and value from a line of text. Can be used to parse simple mail headers, http headers, etc.
lc/1
lc(string()) -> string()
Translates a string to lowercase. Also flattens the list.
pad/2
pad(string(), integer()) -> string()
Pads a string to a given width in characters.
pad/3
pad(string(), integer(), left | right | centre) -> string()
Pads a string to a given width in characters.
quote_regexp/1
quote_regexp(string()) -> string()
Inserts escape chars into string to make it a literal regexp.
This way, characters which have special meaning in regular expressions
can be used within a regular expression.
Similar to Perl's quotemeta function.
remove_eol/1
remove_eol(string()) -> string()
Removes a single newline from the end of a string. Should work on both 'nix and MS-DOS newlines.
split/2
split(char(), string()) -> [string()]
Splits a string on each occurance of a delimeter. e.g. split($+, "a+b++c") -> ["a", "b", "", "c"]
strip_quotes/1
strip_quotes(string()) -> string()
Equivalent to strip_quotes(string(), $").
strip_quotes/2
strip_quotes(string(), char()) -> string()
Strips leading and trailing quotes from a string.
uc/1
uc(string()) -> string()
Translates a string to uppercase. Also flattens the list.
Documented Internal Functions
unescape/1
unescape(string()) -> string()
Unescapes backslash-escaped sequences in a string.