Module openflax.string

OpenFlax string functions.

Description

OpenFlax string functions.

These are functions for manipulating strings used by OpenFlax. They should only be used by OpenFlax; for general-purpose versions of these functions, see the ce_string, ce_lists and ce_lib modules of the ce application.

Function Index

chomp/1Removes all newlines from the end of a string.
decode_hex/1Parses the given string as an integer in hexadecimal notation.
from_datetime_rfc_1123/0

Equivalent to from_datetime_rfc_1123(calendar:universal_time()).

from_datetime_rfc_1123/1Returns a date/time string formatted in accordance to RFC 1123.
from_header/1Given an HTTP-header format string such as "Content-Type", returns a string suitable for easy use as an atom (content_type.).
from_term/1Tries to convert any term into a string.
join/2Joins strings with a delimeter between each part.
keyvalue/2Gets the key and value from a line of text.
substitute/3Returns a string with the all characters equal to the first argument replaced with the second argument.
to_atom/1Tries to convert a string into an atom.
to_caps/1Capitalizes each letter that is not preceded by a letter.
to_header/1Given an string such as "content_type", returns a string suitable for use as an HTTP-header field name ("Content-Type".).
to_lower/1Converts the given string to all lowercase.
to_upper/1Converts the given string to all uppercase.
truncate/1Returns a string containing all but the last character of a given string.

Function Details

chomp/1

chomp(List::string()) -> string()

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

decode_hex/1

decode_hex(String::string()) -> integer()

Parses the given string as an integer in hexadecimal notation.

from_datetime_rfc_1123/0

from_datetime_rfc_1123() -> string()

Equivalent to from_datetime_rfc_1123(calendar:universal_time()).

from_datetime_rfc_1123/1

from_datetime_rfc_1123(X1::{date(), time()}) -> string()

Returns a date/time string formatted in accordance to RFC 1123. This sort of date/time looks like "Sun, 06 Nov 1994 08:23:19 GMT".

from_header/1

from_header(String::string()) -> string()

Given an HTTP-header format string such as "Content-Type", returns a string suitable for easy use as an atom (content_type.)

from_term/1

from_term(F::term()) -> string()

Tries to convert any term into a string.

join/2

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

Joins strings with a delimeter between each part.

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.

substitute/3

substitute(A::char(), B::char(), L::string()) -> string()

Returns a string with the all characters equal to the first argument replaced with the second argument.

to_atom/1

to_atom(String::string()) -> atom()

Tries to convert a string into an atom.

to_caps/1

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

Capitalizes each letter that is not preceded by a letter.

to_header/1

to_header(String::string()) -> string()

Given an string such as "content_type", returns a string suitable for use as an HTTP-header field name ("Content-Type".)

to_lower/1

to_lower(String::string()) -> string()

Converts the given string to all lowercase.

to_upper/1

to_upper(String::string()) -> string()

Converts the given string to all uppercase.

truncate/1

truncate(T::string()) -> string()

Returns a string containing all but the last character of a given string.