View Source z_string (zotonic_stdlib v1.19.0)
Summary
Functions
Concatenate two strings (list or binary). Return type matching the first part.
Return true if What is found in the string
Calculate the Levensthein distance between two strings. Adapted from https://rosettacode.org/wiki/Levenshtein_distance#Erlang to use binary utf8 strings and maps. The smaller the returned integer the closer the strings are. Distance 0 means the two strings are equal.
Return true if Word ends with End
Escape special characters for ical RFC2445 elements
Return the first character of a string.
Check if the variable is a one dimensional list of bytes, or a valid utf-8 binary.
Is the character an ASCII or Unicode whitespace character? See @link https://en.wikipedia.org/wiki/Whitespace_character
Return the last character of a string
Make sure that the string is on one line only, replace control characters with spaces
Transliterate an unicode string to an ascii string with lowercase characters. Tries to transliterate some characters to a..z
Remove all spaces and control characters from a string.
Replace a string inside another string Copyright 2008 Rusty Klophaus (Nitrogen, MIT License)
Sanitize an utf-8 string, remove all non-utf-8 characters.
Split a string, see http://www.erlang.org/pipermail/erlang-questions/2008-October/038896.html
Split the binary into lines. Line separators can be \r, \n or \r\n.
Return true if Start is a prefix of Word
Return a lowercase string for the input
Map a string to a value that can be used as a name or slug. Maps all characters to lowercase and remove non digalpha chars
Filter a filename so that we obtain a basename that is safe to use.
Map a string to a slug that can be used in the uri of a page. Same as a name, but then with dashes instead of underscores.
Return a uppercase string for the input
Remove whitespace at the start and end of the string
Remove all occurrences of a character at the start and end of a string.
Remove whitespace at the start the string
Remove all occurrences of a char at the start of a string
Remove whitespace at the end of the string
Remove all occurrences of a char at the end of the string
Truncate a string. Append the '...' character at the place of break off.
Truncate a string, count all characters. No special handling of entities and tags.
Truncate a string, count all words. No special handling of entities and tags.
Remove the first and last char if they are double quotes.
Functions
-spec distance(S, T) -> Distance when S :: binary() | string(), T :: binary() | string(), Distance :: non_neg_integer().
-spec first_char(binary() | list()) -> non_neg_integer().
-spec is_whitespace(non_neg_integer()) -> boolean().
-spec last_char(binary() | string()) -> non_neg_integer().
-spec to_rootname(file:filename_all()) -> binary().