Module ux_string

String functions.

Copyright © 2010-2011 Michael Uvarov

Authors: Michael Uvarov (arcusfelis@gmail.com).

Description

String functions.

Data Types

char_type()

char_type() = ux_types:char_type()

Function Index

delete_types/2Returns a new string which is made from the chars of Str which are not a type from Types list.
delete_types/3Stops delete_type/2 after Limit deleted chars.
explode/2Splits the string by delimeters.
explode/3
explode_types/2Returns a new list of strings which are parts of Str splited by separator chars of a type from Types list.
extract_words/1
filter_types/2Returns a new string which is made from the chars of Str which are a type from Types list.
filter_types/3Stops after -Limit skipped chars.
first/2Return Len chars from the beginning of the string.
first_types/3If Len<0, then gets first Len chars of type, which is in Types If Len>0, then gets first -Len chars of type, which is NOT in Types.
freq/1Counts how many identical chars in the string.
is_nfc/1
is_nfd/1
is_nfkc/1
is_nfkd/1
last/2Return Len chars from the beginning of the string.
last_types/3If Len<0, then gets last Len chars of type, which is in Types If Len>0, then gets last -Len chars of type, which is NOT in Types.
length/1Compute count of graphemes in the string.
reverse/1Reverses the string graphemes.
script/1
scripts/1
split/2
split/3
split_types/2Returns a new list of strings which are parts of Str splited by separator chars of a type from Types list.
to_graphemes/1Split unicode string into [graphemes](http://en.wikipedia.org/wiki/Grapheme).
to_lower/1Converts characters of a string to a lowercase format.
to_ncr/1Convert everything from utf-8 into an NCR (Numeric Character Reference).
to_nfc/1
to_nfd/1
to_nfkc/1
to_nfkd/1
to_string/1Converts something to string (list).
to_upper/1Converts characters of a string to a uppercase format.
types/1Returns various "character types" which can be used as a default categorization in implementations.

Function Details

delete_types/2

delete_types(Types::[char_type()], Str::string()) -> string() | none()

Returns a new string which is made from the chars of Str which are not a type from Types list.

delete_types/3

delete_types(Types::[char_type()], Str::string(), Limit::integer()) -> string() | none()

Stops delete_type/2 after Limit deleted chars. If Limit < 0, then stops after -Limit skipped chars.

explode/2

explode(Delimeter::[nonempty_string()], Str::string()) -> [string()]

explode(Delimeter::char(), Str::string()) -> [string()]

explode(Delimeter::nonempty_string(), Str::string()) -> [string()]

Splits the string by delimeters.

explode/3

explode(Delimeter::[nonempty_string()], Str::string(), Limit::integer()) -> string()

explode(Delimeter::char(), Str::string(), Limit::integer()) -> [string()]

explode(Delimeter::nonempty_string(), Str::string(), Limit::integer()) -> [string()]

explode_types/2

explode_types(Types::[char_type()], Str::string()) -> string()

Returns a new list of strings which are parts of Str splited by separator chars of a type from Types list.

extract_words/1

extract_words(S) -> any()

filter_types/2

filter_types(Types::[char_type()], Str::string()) -> string() | none()

Returns a new string which is made from the chars of Str which are a type from Types list.

filter_types/3

filter_types(Types::[char_type()], Str::string(), Limit::integer()) -> string() | none()

Stops after -Limit skipped chars.

first/2

first(Str, Len) -> any()

Return Len chars from the beginning of the string.

first_types/3

first_types(Types::[char_type()], Str::string(), Len::integer()) -> string() | none()

If Len<0, then gets first Len chars of type, which is in Types If Len>0, then gets first -Len chars of type, which is NOT in Types

freq/1

freq(Str) -> any()

Counts how many identical chars in the string. Returns a dict. Example:

  >dict:to_list(ux_string:freq("FFDF")).
  [{70,3},{68,1}]

is_nfc/1

is_nfc(Str::list()) -> yes | no | 'maybe'

is_nfd/1

is_nfd(Str::list()) -> yes | no | 'maybe'

is_nfkc/1

is_nfkc(Str::list()) -> yes | no | 'maybe'

is_nfkd/1

is_nfkd(Str::list()) -> yes | no | 'maybe'

last/2

last(Str, Len) -> any()

Return Len chars from the beginning of the string.

last_types/3

last_types(Types::[char_type()], Str::string(), Len::integer()) -> string() | none()

If Len<0, then gets last Len chars of type, which is in Types If Len>0, then gets last -Len chars of type, which is NOT in Types

length/1

length(S) -> any()

Compute count of graphemes in the string.

reverse/1

reverse(Str) -> any()

Reverses the string graphemes.

script/1

script(S) -> any()

scripts/1

scripts(S) -> any()

split/2

split(P1, P2) -> any()

split/3

split(P1, P2, P3) -> any()

split_types/2

split_types(Types::[char_type()], Str::string()) -> string()

Returns a new list of strings which are parts of Str splited by separator chars of a type from Types list. Parts can not be empty.

to_graphemes/1

to_graphemes(Str) -> any()

Split unicode string into [graphemes](http://en.wikipedia.org/wiki/Grapheme). Based on [UAX29: UNICODE TEXT SEGMENTATION] (http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries).

It is important to recognize that what the user thinks of as a "character"—a basic unit of a writing system for a language—may not be just a single Unicode code point. Instead, that basic unit may be made up of multiple Unicode code points. To avoid ambiguity with the computer use of the term character, this is called a user-perceived character. For example, “G” + acute-accent is a user-perceived character: users think of it as a single character, yet is actually represented by two Unicode code points. These user-perceived characters are approximated by what is called a grapheme cluster, which can be determined programmatically.

to_lower/1

to_lower(Str::string()) -> string()

Converts characters of a string to a lowercase format.

to_ncr/1

to_ncr(Str) -> any()

Convert everything from utf-8 into an NCR (Numeric Character Reference).

to_nfc/1

to_nfc(Str::list()) -> list()

to_nfd/1

to_nfd(Str::list()) -> list()

to_nfkc/1

to_nfkc(Str::list()) -> list()

to_nfkd/1

to_nfkd(Str::list()) -> list()

to_string/1

to_string(Str::string() | atom() | integer()) -> string()

Converts something to string (list).

to_upper/1

to_upper(Str::string()) -> string()

Converts characters of a string to a uppercase format.

types/1

types(Str) -> any()

Returns various "character types" which can be used as a default categorization in implementations. Types: http://www.ksu.ru/eng/departments/ktk/test/perl/lib/unicode/UCDFF301.html#General%20Category


Generated by EDoc