Module ce_string

String library.

Description

String library.

Function Index

caps/1Equivalent to caps(String, {$\s, $\s}).
caps/2Capitalizes each letter that is not preceded by a letter.
chomp/1Removes all newlines from the end of a string.
columns/2Translates string into list of strings by columns.
extract/2Extracts a field at a given location from a string.
extract/3Extracts a field at a given location with a given width.
fields/3Translates string into list of strings by fields.
join/2Joins strings with a delimeter between each part.
join/3Joins strings with a delimeter between each part and a second delimeter between the last two parts.
keyvalue/1Equivalent to keyvalue(string(), ":").
keyvalue/2Gets the key and value from a line of text.
lc/1Translates a string to lowercase.
pad/2Pads a string to a given width in characters.
pad/3Pads a string to a given width in characters.
quote_regexp/1Inserts escape chars into string to make it a literal regexp.
remove_eol/1Removes a single newline from the end of a string.
split/2Splits a string on each occurance of a delimeter.
strip_quotes/1Equivalent to strip_quotes(string(), $").
strip_quotes/2Strips leading and trailing quotes from a string.
uc/1Translates a string to uppercase.

Function Details

caps/1

caps(S::string() | atom()) -> string()

Equivalent to caps(String, {$\s, $\s}).

caps/2

caps(S::string() | atom(), X2::{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(List::string()) -> string()

Removes all newlines from the end of a string. Should work on both 'nix and MS-DOS newlines.

columns/2

columns(String::string(), Schema::schema()) -> [string()]

Translates string into list of strings by columns. e.g. columns("1234567890", [{2,3},{8,2}]) -> ["234", "89"]

extract/2

extract(String::string(), Start::integer()) -> string()

Extracts a field at a given location from a string. Returns the field with spaces stripped off.

extract/3

extract(String::string(), Start::integer(), Length::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(), Delim::string(), Quote::string()) -> [string()]

Translates string into list of strings by fields. e.g. fields("a,'b,c',d", ",", "'") -> ["a","b,c","d"]

join/2

join(P::string(), L::[string()]) -> string()

Joins strings with a delimeter between each part.

join/3

join(P::string(), Q::string(), L::[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(), string()}

Equivalent to keyvalue(string(), ":").

keyvalue/2

keyvalue(String::string(), Delim::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(L::string()) -> string()

Translates a string to lowercase. Also flattens the list.

pad/2

pad(String::string(), Width::integer()) -> string()

Pads a string to a given width in characters.

pad/3

pad(String::string(), Width::integer(), X3::left | right | centre) -> string()

Pads a string to a given width in characters.

quote_regexp/1

quote_regexp(String::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(S::string()) -> string()

Removes a single newline from the end of a string. Should work on both 'nix and MS-DOS newlines.

split/2

split(D::char(), L::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(S::string()) -> string()

Equivalent to strip_quotes(string(), $").

strip_quotes/2

strip_quotes(S::string(), Q::char()) -> string()

Strips leading and trailing quotes from a string.

uc/1

uc(L::string()) -> string()

Translates a string to uppercase. Also flattens the list.


Generated by EDoc, Dec 25 2007, 02:37:50.