file
strings.hhNamespaces
- namespace Ase
- The Anklang C++ API namespace.
Classes
- class Ase::Strings
- Convenience Constructor for StringSeq or std::vector<std::string>
Functions
- auto cstrings_to_vector(const char* s, ...) → StringS
- Construct a StringS from a NULL terminated list of string arguments.
- auto current_locale_strtold(const char* nptr, char** endptr) → long double
- Parse a double from a string ala strtod(), trying locale specific characters and POSIX/C formatting.
- void memset4(uint32* mem, uint32 filler, uint length)
- Fill a memory area with a 32-bit quantitiy.
- auto posix_locale_strtold(const char* nptr, char** endptr) → long double
- Parse a double from a string ala strtod(), trying locale specific characters and POSIX/C formatting.
- auto strerror(int errno_num) → const char*
- Get POSIX locale strerror.
- auto string_canonify(const String& string, const String& valid_chars, const String& substitute) → String
- auto string_capitalize(const String& str, size_t maxn, bool rest_tolower) → String
- Capitalize words, so the first letter is upper case, the rest lower case.
- auto string_casecmp(const String& s1, const String& s2) → int
- Like strcasecmp(3) for UTF-8 strings.
- auto string_casefold(const String& src) → String
- Yield UTF-8 string useful for case insensitive comparisons.
- auto string_cmp(const String& s1, const String& s2) → int
- Like strcmp(3) for UTF-8 strings.
- auto string_cmp_uuid(const String& uuid_string1, const String& uuid_string2) → int
- Returns whether uuid_string1 compares smaller (-1), equal (0) or greater (+1) to uuid_string2.
- auto string_endswith(const String& string, const String& fragment) → bool
- Returns whether
string
ends withfragment
. - auto string_endswith(const String& string, const StringS& fragments) → bool
- Returns whether string ends with any element of
fragments
. - auto string_find_word(const char* haystack, const char* word) → const char*
- Find occurance of
word
inhaystack
. -
template <class... Args>auto string_format(const char* format, const Args&... args) → ASE_NOINLINE String
- Formatted printing ala printf() into a String, using the POSIX/C locale.
- auto string_from_bool(bool value) → String
- Convert a boolean value into a string.
- auto string_from_cquote(const String& input) → String
- Parse a possibly quoted C string into regular string.
- auto string_from_double(double value) → String
- Convert a double into a string, using the POSIX/C locale.
-
auto string_from_double_vector(const std::
vector<double>& dvec, const String& delim) → String - Construct a string out of all double values passed in dvec, separated by delim.
- auto string_from_errno(int errno_val) → String
- Returns a String describing the passed in errno value, similar to strerror().
- auto string_from_float(float value) → String
- Convert a float into a string, using the POSIX/C locale.
- auto string_from_int(int64 value) → String
- Convert a 64bit signed integer into a string.
- auto string_from_long_double(long double value) → String
- Convert a long double into a string, using the POSIX/C locale.
- auto string_from_pretty_function_name(const char* cxx_pretty_function) → String
-
template <typename Type>auto string_from_type(Type value) → String
- Create a string from a templated argument value, such as bool, int, double.
- auto string_from_uint(uint64 value) → String
- Convert a 64bit unsigned integer into a string.
- auto string_has_int(const String& string) → bool
- Checks if a string contains a digit, optionally preceeded by whitespaces.
- auto string_hexdump(const void* addr, size_t length, size_t initial_offset) → String
- auto string_is_canonified(const String& string, const String& valid_chars) → bool
- Check if string_
canonify() would modify string. - auto string_is_uuid(const String& uuid_string) → bool
- Returns whether uuid_string contains a properly formatted UUID string.
- auto string_islower(const String& str) → bool
- Check if all string characters are Unicode lower case characters.
- auto string_isupper(const String& str) → bool
- Check if all string characters are Unicode upper case characters.
- auto string_join(const String& junctor, const StringS& strvec) → String
-
template <class... Args>auto string_locale_format(const char* format, const Args&... args) → ASE_NOINLINE String
- Formatted printing ala printf() into a String, using the current locale.
-
auto string_locale_vprintf(const char* format,
va_
list vargs) → String - Formatted printing like string_vprintf using the current locale.
- auto string_lstrip(const String& input) → String
- Strip whitespaces from the left of a string.
- auto string_match_identifier(const String& ident1, const String& ident2) → bool
- Check equality of strings canonicalized to "[0-9a-z_]+".
- auto string_match_identifier_tail(const String& ident, const String& tail) → bool
- Variant of string_
match_ identifier() that matches tail against ident at word boundary. - auto string_multiply(const String& s, uint64 count) → String
- Reproduce a string s for count times.
- auto string_normalize_nfc(const String& src) → String
- Yield normalized composed UTF-8 string.
- auto string_normalize_nfd(const String& src) → String
- Yield normalized decomposed UTF-8 string.
- auto string_normalize_nfkc(const String& src) → String
- Formatting stripped normalized composed UTF-8 string.
- auto string_normalize_nfkd(const String& src) → String
- Formatting stripped normalized decomposed UTF-8 string.
- auto string_option_check(const String& optionlist, const String& feature) → bool
- Check if an option is set/unset in an options list string.
- auto string_option_find(const String& optionlist, const String& feature, const String& fallback) → String
- Retrieve the option value from an options list separated by ':' or ';' or
fallback
. -
auto string_option_find_value(const char* string,
const char* feature,
const String& fallback,
const String& denied,
bool matchallnone) → std::
string_view - Low level option search, avoids dynamic allocations.
- auto string_replace(const String& input, const String& marker, const String& replacement, size_t maxn) → String
- Replace substring marker in input with replacement, at most maxn times.
- auto string_rstrip(const String& input) → String
- Strip whitespaces from the right of a string.
- auto string_set_A2Z() → const String&
- Returns a string containing all of A-Z.
- auto string_set_a2z() → const String&
- Returns a string containing all of a-z.
- auto string_set_ascii_alnum() → const String&
- Returns a string containing all of 0-9, A-Z and a-z.
- auto string_split(const String& string, const String& splitter, size_t maxn) → StringS
- auto string_split_any(const String& string, const String& splitchars, size_t maxn) → StringS
- auto string_startswith(const String& string, const String& fragment) → bool
- Returns whether
string
starts withfragment
. - auto string_startswith(const String& string, const StringS& fragments) → bool
- Returns whether string starts with any element of
fragments
. - auto string_strip(const String& input) → String
- Strip whitespaces from the left and right of a string.
- auto string_substitute_char(const String& input, const char match, const char subst) → String
- Replace all occouranes of match in input with subst.
- auto string_to_bool(const String& string, bool fallback) → bool
- auto string_to_cescape(const String& str) → String
- auto string_to_cquote(const String& str) → String
- Returns a string as C string including double quotes.
- auto string_to_double(const String& string) → double
- Parse a double from a string, trying locale specific characters and POSIX/C formatting.
- auto string_to_double(const char* dblstring, const char** endptr) → double
- Similar to string_
to_ double(const String&), but returns the first failing character position in endptr. -
auto string_to_double_vector(const String& string) → std::
vector<double> - Parse a string into a list of doubles, expects ';' as delimiter.
- auto string_to_hex(const String& input) → String
- Convert bytes in string
input
to hexadecimal numbers. - auto string_to_identifier(const String& input) → String
- Force lower case, alphanumerics + underscore and non-digit start.
- auto string_to_int(const String& string, size_t* consumed, uint base) → int64
- Parse a string into a 64bit integer, optionally specifying the expected number base.
- auto string_to_long_double(const String& string) → long double
- Parse a long double from a string, trying locale specific characters and POSIX/C formatting.
- auto string_to_long_double(const char* dblstring, const char** endptr) → long double
- Similar to string_
to_ long_ double(const String&), but returns the first failing character position in endptr. - auto string_to_seconds(const String& string, double fallback) → double
- Parse string into seconds.
-
template <typename Type>auto string_to_type(const String& string) → Type
- Convert a string to template argument type, such as bool, int, double.
- auto string_to_uint(const String& string, size_t* consumed, uint base) → uint64
- Parse a string into a 64bit unsigned integer, optionally specifying the expected number base.
- auto string_tolower(const String& str) → String
- Convert all string characters into Unicode lower case characters.
- auto string_totitle(const String& str) → String
- Convert all string characters into Unicode title characters.
- auto string_toupper(const String& str) → String
- Convert all string characters into Unicode upper case characters.
- auto string_url_decode(const String& urlstr, const bool form_url_encoded) → String
- Decode URL %-sequences in a string, decode '+' if
form_url_encoded
. - auto string_url_encode(const String& rawstr, const bool form_url_encoded) → String
- Encode special characters to URL %-sequences, encode space as '+' if
form_url_encoded
. - void string_vector_erase_empty(StringS& svector)
- Remove empty elements from a string vector.
- auto string_vector_find(const StringS& svector, const String& prefix, const String& fallback) → String
- auto string_vector_find_value(const StringS& svector, const String& prefix, const String& fallback) → String
- void string_vector_lstrip(StringS& svector)
- Left-strip all elements of a string vector, see string_
lstrip(). - void string_vector_rstrip(StringS& svector)
- Right-strip all elements of a string vector, see string_
rstrip(). - void string_vector_strip(StringS& svector)
- Strip all elements of a string vector, see string_
strip(). -
auto string_vprintf(const char* format,
va_
list vargs) → String - Formatted printing ala vprintf() into a String, using the POSIX/C locale.
- auto text_convert(const String& to_charset, String& output_string, const String& from_charset, const String& input_string, const String& fallback_charset, const String& output_mark) → bool