Thrill
0.1
|
Classes | |
struct | less_icase_asc |
Case-insensitive less order relation functional class for std::map, etc. More... | |
struct | less_icase_desc |
struct | LevenshteinStandardICaseParameters |
Standard parameters to Levenshtein distance function. More... | |
struct | LevenshteinStandardParameters |
Standard parameters to levenshtein distance function. More... | |
Functions | |
std::istream & | appendline (std::istream &is, std::string &str, char delim) |
int | compare_icase (const char *a, const char *b) |
returns +1/0/-1 like strcmp(a, b) but without regard for letter case More... | |
int | compare_icase (const char *a, const std::string &b) |
returns +1/0/-1 like strcmp(a, b) but without regard for letter case More... | |
int | compare_icase (const std::string &a, const char *b) |
returns +1/0/-1 like strcmp(a, b) but without regard for letter case More... | |
int | compare_icase (const std::string &a, const std::string &b) |
returns +1/0/-1 like strcmp(a, b) but without regard for letter case More... | |
bool | contains (const std::string &str, const std::string &pattern) |
Tests of string contains pattern. More... | |
bool | contains (const std::string &str, const char *pattern) |
Tests of string contains pattern. More... | |
bool | contains (const std::string &str, const char ch) |
Tests of string contains character. More... | |
bool | contains_word (const std::string &str, const char *word) |
Search the given string for a whitespace-delimited word. More... | |
bool | contains_word (const std::string &str, const std::string &word) |
Search the given string for a whitespace-delimited word. More... | |
bool | ends_with (const char *str, const char *match) |
Checks if the given match string is located at the end of this string. More... | |
bool | ends_with (const char *str, const std::string &match) |
Checks if the given match string is located at the end of this string. More... | |
bool | ends_with (const std::string &str, const char *match) |
Checks if the given match string is located at the end of this string. More... | |
bool | ends_with (const std::string &str, const std::string &match) |
Checks if the given match string is located at the end of this string. More... | |
bool | ends_with_icase (const std::string &str, const char *match) |
Checks if the given match string is located at the end of this string. More... | |
bool | ends_with_icase (const std::string &str, const std::string &match) |
Checks if the given match string is located at the end of this string. More... | |
bool | equal_icase (const char *a, const char *b) |
returns true if a == b without regard for letter case More... | |
bool | equal_icase (const char *a, const std::string &b) |
returns true if a == b without regard for letter case More... | |
bool | equal_icase (const std::string &a, const char *b) |
returns true if a == b without regard for letter case More... | |
bool | equal_icase (const std::string &a, const std::string &b) |
returns true if a == b without regard for letter case More... | |
std::string & | erase_all (std::string *str, char drop=' ') |
Remove all occurrences of the given character in-place. More... | |
std::string & | erase_all (std::string *str, const char *drop) |
Remove all occurrences of the given characters in-place. More... | |
std::string & | erase_all (std::string *str, const std::string &drop) |
Remove all occurrences of the given characters in-place. More... | |
std::string | erase_all (const std::string &str, char drop=' ') |
Remove all occurrences of the given character, return copy of string. More... | |
std::string | erase_all (const std::string &str, const char *drop) |
Remove all occurrences of the given characters, return copy of string. More... | |
std::string | erase_all (const std::string &str, const std::string &drop) |
Remove all occurrences of the given characters, return copy of string. More... | |
std::string | escape_html (const std::string &str) |
Escape characters for inclusion in HTML documents: replaces the characters <, >, & and " with HTML entities. More... | |
std::string | escape_html (const char *str) |
Escape characters for inclusion in HTML documents: replaces the characters <, >, & and " with HTML entities. More... | |
std::string | escape_uri (const std::string &str) |
Escape a string into a URI-encoding. More... | |
std::string | escape_uri (const char *str) |
Escape a string into a URI-encoding. More... | |
std::string & | expand_environment_variables (std::string *s) |
Expand substrings $ABC_123 and ${ABC_123} into the corresponding environment variables. More... | |
std::string | expand_environment_variables (const std::string &s) |
Expand substrings $ABC_123 and ${ABC_123} into the corresponding environment variables. More... | |
std::string | expand_environment_variables (const char *s) |
Expand substrings $ABC_123 and ${ABC_123} into the corresponding environment variables. More... | |
std::string | extract_between (const std::string &str, const char *sep1, const char *sep2) |
Search the string for given start and end separators and extract all characters between the both, if they are found. More... | |
std::string | extract_between (const std::string &str, const char *sep1, const std::string &sep2) |
Search the string for given start and end separators and extract all characters between the both, if they are found. More... | |
std::string | extract_between (const std::string &str, const std::string &sep1, const char *sep2) |
Search the string for given start and end separators and extract all characters between the both, if they are found. More... | |
std::string | extract_between (const std::string &str, const std::string &sep1, const std::string &sep2) |
Search the string for given start and end separators and extract all characters between the both, if they are found. More... | |
std::string | format_iec_units (uint64_t number, int precision) |
Format number as something like 1 TiB. More... | |
std::string | format_si_units (uint64_t number, int precision) |
Format number as something like 1 TB. More... | |
static uint32_t | hash_djb2 (const unsigned char *str) |
Simple, fast, but "insecure" string hash method by Dan Bernstein from http://www.cse.yorku.ca/~oz/hash.html. More... | |
static uint32_t | hash_djb2 (const char *str) |
Simple, fast, but "insecure" string hash method by Dan Bernstein from http://www.cse.yorku.ca/~oz/hash.html. More... | |
static uint32_t | hash_djb2 (const unsigned char *str, size_t size) |
Simple, fast, but "insecure" string hash method by Dan Bernstein from http://www.cse.yorku.ca/~oz/hash.html. More... | |
static uint32_t | hash_djb2 (const char *str, size_t size) |
Simple, fast, but "insecure" string hash method by Dan Bernstein from http://www.cse.yorku.ca/~oz/hash.html. More... | |
static uint32_t | hash_djb2 (const std::string &str) |
Simple, fast, but "insecure" string hash method by Dan Bernstein from http://www.cse.yorku.ca/~oz/hash.html. More... | |
static uint32_t | hash_sdbm (const unsigned char *str) |
Simple, fast, but "insecure" string hash method by sdbm database from http://www.cse.yorku.ca/~oz/hash.html. More... | |
static uint32_t | hash_sdbm (const char *str) |
Simple, fast, but "insecure" string hash method by sdbm database from http://www.cse.yorku.ca/~oz/hash.html. More... | |
static uint32_t | hash_sdbm (const unsigned char *str, size_t size) |
Simple, fast, but "insecure" string hash method by sdbm database from http://www.cse.yorku.ca/~oz/hash.html. More... | |
static uint32_t | hash_sdbm (const char *str, size_t size) |
Simple, fast, but "insecure" string hash method by sdbm database from http://www.cse.yorku.ca/~oz/hash.html. More... | |
static uint32_t | hash_sdbm (const std::string &str) |
Simple, fast, but "insecure" string hash method by sdbm database from http://www.cse.yorku.ca/~oz/hash.html. More... | |
size_t | index_of (const std::vector< std::string > &list, const char *str) |
Attempts to find str in the list and return the index. More... | |
size_t | index_of (const std::vector< std::string > &list, const std::string &str) |
Attempts to find str in the list and return the index. More... | |
size_t | index_of_icase (const std::vector< std::string > &list, const char *str) |
Attempts to find str in the list and return the index using case-insensitive comparisons. More... | |
size_t | index_of_icase (const std::vector< std::string > &list, const std::string &str) |
Attempts to find str in the list and return the index using case-insensitive comparisons. More... | |
bool | less_icase (const char *a, const char *b) |
returns true if a < b without regard for letter case More... | |
bool | less_icase (const char *a, const std::string &b) |
returns true if a < b without regard for letter case More... | |
bool | less_icase (const std::string &a, const char *b) |
returns true if a < b without regard for letter case More... | |
bool | less_icase (const std::string &a, const std::string &b) |
returns true if a < b without regard for letter case More... | |
static size_t | levenshtein (const char *a, const char *b) |
Computes the Levenshtein string distance between two strings. More... | |
static size_t | levenshtein (const std::string &a, const std::string &b) |
Computes the Levenshtein string distance between two strings. More... | |
template<typename Param > | |
static size_t | levenshtein_algorithm (const char *a, size_t a_size, const char *b, size_t b_size) |
Computes the Levenshtein string distance also called edit distance between two strings. More... | |
static size_t | levenshtein_icase (const char *a, const char *b) |
Computes the Levenshtein string distance between two strings. More... | |
static size_t | levenshtein_icase (const std::string &a, const std::string &b) |
Computes the Levenshtein string distance between two strings. More... | |
std::string | pad (const std::string &s, size_t len, char pad_char=' ') |
Truncate or pad string to exactly len characters. More... | |
bool | parse_si_iec_units (const char *str, uint64_t *out_size, char default_unit=0) |
Parse a string like "343KB" or "44 GiB" into the corresponding size in bytes. More... | |
bool | parse_si_iec_units (const std::string &str, uint64_t *out_size, char default_unit=0) |
Parse a string like "343KB" or "44 GiB" into the corresponding size in bytes. More... | |
std::vector< std::string > | split_words (const std::string &str, std::string::size_type limit=std::string::npos) |
Split the given string by whitespaces into distinct words. More... | |
std::string | ssnprintf (size_t max_size, const char *fmt,...) TLX_ATTRIBUTE_FORMAT_PRINTF(2 |
Helper for return the result of a snprintf() call inside a std::string. More... | |
template<typename String = std::string> | |
String | ssnprintf_generic (size_t max_size, const char *fmt,...) TLX_ATTRIBUTE_FORMAT_PRINTF(2 |
Helper for return the result of a snprintf() call inside a string object. More... | |
std::string | ssprintf (const char *fmt,...) TLX_ATTRIBUTE_FORMAT_PRINTF(1 |
Helper for return the result of a sprintf() call inside a std::string. More... | |
template<typename String = std::string> | |
String | ssprintf_generic (const char *fmt,...) TLX_ATTRIBUTE_FORMAT_PRINTF(1 |
Helper for return the result of a sprintf() call inside a string object. More... | |
bool | starts_with (const char *str, const char *match) |
Checks if the given match string is located at the start of this string. More... | |
bool | starts_with (const char *str, const std::string &match) |
Checks if the given match string is located at the start of this string. More... | |
bool | starts_with (const std::string &str, const char *match) |
Checks if the given match string is located at the start of this string. More... | |
bool | starts_with (const std::string &str, const std::string &match) |
Checks if the given match string is located at the start of this string. More... | |
bool | starts_with_icase (const char *str, const char *match) |
Checks if the given match string is located at the start of this string. More... | |
bool | starts_with_icase (const char *str, const std::string &match) |
Checks if the given match string is located at the start of this string. More... | |
bool | starts_with_icase (const std::string &str, const char *match) |
Checks if the given match string is located at the start of this string. More... | |
bool | starts_with_icase (const std::string &str, const std::string &match) |
Checks if the given match string is located at the start of this string. More... | |
char | to_lower (char ch) |
Transform the given character to lower case without any localization. More... | |
std::string & | to_lower (std::string *str) |
Transforms the given string to lowercase and returns a reference to it. More... | |
std::string | to_lower (const std::string &str) |
Returns a copy of the given string converted to lowercase. More... | |
char | to_upper (char ch) |
Transform the given character to upper case without any localization. More... | |
std::string & | to_upper (std::string *str) |
Transforms the given string to uppercase and returns a reference to it. More... | |
std::string | to_upper (const std::string &str) |
Returns a copy of the given string converted to uppercase. More... | |
std::string | union_words (const std::string &wordsA, const std::string &wordsB) |
Return union of two keyword sets. More... | |
std::string | word_wrap (const std::string &str, unsigned int wrap=80) |
Try to wrap a string to 80 columns without split words. More... | |
Base64 Encoding and Decoding | |
std::string | base64_encode (const void *data, size_t size, size_t line_break=0) |
Encode the given binary data into base64 representation as described in RFC 2045 or RFC 3548. More... | |
std::string | base64_encode (const std::string &str, size_t line_break=0) |
Encode the given binary string into base64 representation as described in RFC 2045 or RFC 3548. More... | |
std::string | base64_decode (const void *data, size_t size, bool strict=true) |
Decode a string in base64 representation as described in RFC 2045 or RFC 3548 and return the original data. More... | |
std::string | base64_decode (const std::string &str, bool strict=true) |
Decode a string in base64 representation as described in RFC 2045 or RFC 3548 and return the original data. More... | |
Bitdump Methods | |
std::string | bitdump_le8 (const void *const data, size_t size) |
Dump a (binary) string as a sequence of 8-bit little-endian bytes. More... | |
std::string | bitdump_le8 (const std::string &str) |
Dump a (binary) string as a sequence of 8-bit little-endian bytes. More... | |
template<typename Type > | |
std::string | bitdump_le8_type (const Type &t) |
Dump a (binary) item as a sequence of 8-bit little-endian bytes. More... | |
std::string | bitdump_be8 (const void *const data, size_t size) |
Dump a (binary) string as a sequence of 8-bit big-endian bytes. More... | |
std::string | bitdump_be8 (const std::string &str) |
Dump a (binary) string as a sequence of 8-bit big-endian bytes. More... | |
template<typename Type > | |
std::string | bitdump_be8_type (const Type &t) |
Dump a (binary) item as a sequence of 8-bit big-endian bytes. More... | |
Hexdump Methods | |
std::string | hexdump (const void *const data, size_t size) |
Dump a (binary) string as a sequence of uppercase hexadecimal pairs. More... | |
std::string | hexdump (const std::string &str) |
Dump a (binary) string as a sequence of uppercase hexadecimal pairs. More... | |
template<typename Type > | |
std::string | hexdump_type (const Type &t) |
Dump a (binary) item as a sequence of uppercase hexadecimal pairs. More... | |
std::string | hexdump (const std::vector< char > &data) |
Dump a char vector as a sequence of uppercase hexadecimal pairs. More... | |
std::string | hexdump (const std::vector< uint8_t > &data) |
Dump a uint8_t vector as a sequence of uppercase hexadecimal pairs. More... | |
std::string | hexdump_sourcecode (const std::string &str, const std::string &var_name="name") |
Dump a (binary) string into a C source code snippet. More... | |
std::string | hexdump_lc (const void *const data, size_t size) |
Dump a (binary) string as a sequence of lowercase hexadecimal pairs. More... | |
std::string | hexdump_lc (const std::string &str) |
Dump a (binary) string as a sequence of lowercase hexadecimal pairs. More... | |
template<typename Type > | |
std::string | hexdump_lc_type (const Type &t) |
Dump a (binary) item as a sequence of lowercase hexadecimal pairs. More... | |
std::string | hexdump_lc (const std::vector< char > &data) |
Dump a char vector as a sequence of lowercase hexadecimal pairs. More... | |
std::string | hexdump_lc (const std::vector< uint8_t > &data) |
Dump a uint8_t vector as a sequence of lowercase hexadecimal pairs. More... | |
std::string | parse_hexdump (const std::string &str) |
Read a string as a sequence of hexadecimal pairs. More... | |
Split and Join | |
std::string | join (char glue, const std::vector< std::string > &parts) |
Join a vector of strings by some glue character between each pair from the sequence. More... | |
std::string | join (const char *glue, const std::vector< std::string > &parts) |
Join a vector of strings by some glue string between each pair from the sequence. More... | |
std::string | join (const std::string &glue, const std::vector< std::string > &parts) |
Join a vector of strings by some glue string between each pair from the sequence. More... | |
template<typename Glue , typename Iterator > | |
static std::string | join (Glue glue, Iterator first, Iterator last) |
Join a sequence of strings by some glue string between each pair from the sequence. More... | |
template<typename Container > | |
static std::string | join (char glue, const Container &parts) |
Join a Container of strings by some glue character between each pair from the sequence. More... | |
template<typename Container > | |
static std::string | join (const char *glue, const Container &parts) |
Join a Container of strings by some glue string between each pair from the sequence. More... | |
template<typename Container > | |
static std::string | join (const std::string &glue, const Container &parts) |
Join a Container of strings by some glue string between each pair from the sequence. More... | |
std::string | join_quoted (const std::vector< std::string > &str, char sep, char quote, char escape) |
Join a vector of strings using a separator character. More... | |
std::string | join_quoted (const std::vector< std::string > &str) |
Join a vector of strings using spaces as separator character. More... | |
std::vector< std::string > | split (char sep, const std::string &str, std::string::size_type limit=std::string::npos) |
Split the given string at each separator character into distinct substrings. More... | |
std::vector< std::string > | split (const char *sep, const std::string &str, std::string::size_type limit=std::string::npos) |
Split the given string at each separator string into distinct substrings. More... | |
std::vector< std::string > | split (const std::string &sep, const std::string &str, std::string::size_type limit=std::string::npos) |
Split the given string at each separator string into distinct substrings. More... | |
std::vector< std::string > | split (char sep, const std::string &str, std::string::size_type min_fields, std::string::size_type limit) |
Split the given string at each separator character into distinct substrings. More... | |
std::vector< std::string > | split (const char *sep, const std::string &str, std::string::size_type min_fields, std::string::size_type limit) |
Split the given string at each separator string into distinct substrings. More... | |
std::vector< std::string > | split (const std::string &sep, const std::string &str, std::string::size_type min_fields, std::string::size_type limit) |
Split the given string at each separator string into distinct substrings. More... | |
std::vector< std::string > & | split (std::vector< std::string > *into, char sep, const std::string &str, std::string::size_type limit=std::string::npos) |
Split the given string at each separator character into distinct substrings. More... | |
std::vector< std::string > & | split (std::vector< std::string > *into, const char *sep, const std::string &str, std::string::size_type limit=std::string::npos) |
Split the given string at each separator string into distinct substrings. More... | |
std::vector< std::string > & | split (std::vector< std::string > *into, const std::string &sep, const std::string &str, std::string::size_type limit=std::string::npos) |
Split the given string at each separator string into distinct substrings. More... | |
std::vector< std::string > & | split (std::vector< std::string > *into, char sep, const std::string &str, std::string::size_type min_fields, std::string::size_type limit) |
Split the given string at each separator character into distinct substrings. More... | |
std::vector< std::string > & | split (std::vector< std::string > *into, const char *sep, const std::string &str, std::string::size_type min_fields, std::string::size_type limit) |
Split the given string at each separator string into distinct substrings. More... | |
std::vector< std::string > & | split (std::vector< std::string > *into, const std::string &sep, const std::string &str, std::string::size_type min_fields, std::string::size_type limit) |
Split the given string at each separator string into distinct substrings. More... | |
std::vector< std::string > | split_quoted (const std::string &str, char sep, char quote, char escape) |
Split the given string at each separator character into distinct substrings. More... | |
std::vector< std::string > | split_quoted (const std::string &str) |
Split the given string at each space into distinct substrings. More... | |
template<typename Functor > | |
static void | split_view (char sep, const std::string &str, Functor &&callback, std::string::size_type limit=std::string::npos) |
Split the given string at each separator character into distinct substrings, and call the given callback with a StringView for each substring. More... | |
Search and Replace | |
std::string & | replace_first (std::string *str, const std::string &needle, const std::string &instead) |
Replace only the first occurrence of needle in str. More... | |
std::string & | replace_first (std::string *str, const std::string &needle, const char *instead) |
Replace only the first occurrence of needle in str. More... | |
std::string & | replace_first (std::string *str, const char *needle, const std::string &instead) |
Replace only the first occurrence of needle in str. More... | |
std::string & | replace_first (std::string *str, const char *needle, const char *instead) |
Replace only the first occurrence of needle in str. More... | |
std::string & | replace_first (std::string *str, char needle, char instead) |
Replace only the first occurrence of needle in str. More... | |
std::string | replace_first (const std::string &str, const std::string &needle, const std::string &instead) |
Replace only the first occurrence of needle in str. More... | |
std::string | replace_first (const std::string &str, const std::string &needle, const char *instead) |
Replace only the first occurrence of needle in str. More... | |
std::string | replace_first (const std::string &str, const char *needle, const std::string &instead) |
Replace only the first occurrence of needle in str. More... | |
std::string | replace_first (const std::string &str, const char *needle, const char *instead) |
Replace only the first occurrence of needle in str. More... | |
std::string | replace_first (const std::string &str, char needle, char instead) |
Replace only the first occurrence of needle in str. More... | |
std::string & | replace_all (std::string *str, const std::string &needle, const std::string &instead) |
Replace all occurrences of needle in str. More... | |
std::string & | replace_all (std::string *str, const std::string &needle, const char *instead) |
Replace all occurrences of needle in str. More... | |
std::string & | replace_all (std::string *str, const char *needle, const std::string &instead) |
Replace all occurrences of needle in str. More... | |
std::string & | replace_all (std::string *str, const char *needle, const char *instead) |
Replace all occurrences of needle in str. More... | |
std::string & | replace_all (std::string *str, char needle, char instead) |
Replace all occurrences of needle in str. More... | |
std::string | replace_all (const std::string &str, const std::string &needle, const std::string &instead) |
Replace all occurrences of needle in str. More... | |
std::string | replace_all (const std::string &str, const std::string &needle, const char *instead) |
Replace all occurrences of needle in str. More... | |
std::string | replace_all (const std::string &str, const char *needle, const std::string &instead) |
Replace all occurrences of needle in str. More... | |
std::string | replace_all (const std::string &str, const char *needle, const char *instead) |
Replace all occurrences of needle in str. More... | |
std::string | replace_all (const std::string &str, char needle, char instead) |
Replace all occurrences of needle in str. More... | |
Trim | |
std::string & | trim (std::string *str) |
Trims the given string in-place on the left and right. More... | |
std::string & | trim (std::string *str, const char *drop) |
Trims the given string in-place on the left and right. More... | |
std::string & | trim (std::string *str, const std::string &drop) |
Trims the given string in-place on the left and right. More... | |
std::string | trim (const std::string &str) |
Trims the given string in-place on the left and right. More... | |
std::string | trim (const std::string &str, const char *drop) |
Trims the given string in-place on the left and right. More... | |
std::string | trim (const std::string &str, const std::string &drop) |
Trims the given string in-place on the left and right. More... | |
std::string & | trim_right (std::string *str) |
Trims the given string in-place only on the right. More... | |
std::string & | trim_right (std::string *str, const char *drop) |
Trims the given string in-place only on the right. More... | |
std::string & | trim_right (std::string *str, const std::string &drop) |
Trims the given string in-place only on the right. More... | |
std::string | trim_right (const std::string &str) |
Trims the given string only on the right. More... | |
std::string | trim_right (const std::string &str, const char *drop) |
Trims the given string only on the right. More... | |
std::string | trim_right (const std::string &str, const std::string &drop) |
Trims the given string only on the right. More... | |
std::string & | trim_left (std::string *str) |
Trims the given string in-place only on the left. More... | |
std::string & | trim_left (std::string *str, const char *drop) |
Trims the given string in-place only on the left. More... | |
std::string & | trim_left (std::string *str, const std::string &drop) |
Trims the given string in-place only on the left. More... | |
std::string | trim_left (const std::string &str) |
Trims the given string only on the left. More... | |
std::string | trim_left (const std::string &str, const char *drop) |
Trims the given string only on the left. More... | |
std::string | trim_left (const std::string &str, const std::string &drop) |
Trims the given string only on the left. More... | |
Simple string manipulations
std::istream & appendline | ( | std::istream & | is, |
std::string & | str, | ||
char | delim = '\n' |
||
) |
like std::getline(istream, string, delim) except that it appends to the string, possibly reusing buffer capacity.
Definition at line 17 of file appendline.cpp.
References max().
std::string base64_decode | ( | const void * | data, |
size_t | size, | ||
bool | strict = true |
||
) |
Decode a string in base64 representation as described in RFC 2045 or RFC 3548 and return the original data.
If a non-whitespace invalid base64 character is encountered and the parameter "strict" is true, then this function will throw a std::runtime_error. If "strict" is false, the character is silently ignored.
data | input data to decode |
size | size of input data to decode |
strict | throw exception on invalid character |
Definition at line 108 of file base64.cpp.
Referenced by tlx::base64_decode().
std::string base64_decode | ( | const std::string & | str, |
bool | strict = true |
||
) |
Decode a string in base64 representation as described in RFC 2045 or RFC 3548 and return the original data.
If a non-whitespace invalid base64 character is encountered and the parameter "strict" is true, then this function will throw a std::runtime_error. If "strict" is false, the character is silently ignored.
str | input string to encode |
strict | throw exception on invalid character |
Definition at line 203 of file base64.cpp.
References tlx::base64_decode().
std::string base64_encode | ( | const void * | data, |
size_t | size, | ||
size_t | line_break = 0 |
||
) |
Encode the given binary data into base64 representation as described in RFC 2045 or RFC 3548.
The output string contains only characters [A-Za-z0-9+/] and is roughly 33% longer than the input. The output string can be broken into lines after n characters, where n must be a multiple of 4.
data | input data to encode |
size | size of input data to encode |
line_break | break the output string every n characters |
Definition at line 25 of file base64.cpp.
Referenced by tlx::base64_encode().
std::string base64_encode | ( | const std::string & | str, |
size_t | line_break = 0 |
||
) |
Encode the given binary string into base64 representation as described in RFC 2045 or RFC 3548.
The output string contains only characters [A-Za-z0-9+/] and is roughly 33% longer than the input. The output string can be broken into lines after n characters, where n must be a multiple of 4.
str | input string to encode |
line_break | break the output string every n characters |
Definition at line 102 of file base64.cpp.
References tlx::base64_encode().
std::string bitdump_be8 | ( | const void *const | data, |
size_t | size | ||
) |
Dump a (binary) string as a sequence of 8-bit big-endian bytes.
data | binary data to output as bits |
size | length of binary data |
Definition at line 51 of file bitdump.cpp.
Referenced by tlx::bitdump_be8(), tlx::bitdump_be8_type(), and tlx::bitdump_le8_type().
std::string bitdump_be8 | ( | const std::string & | str | ) |
Dump a (binary) string as a sequence of 8-bit big-endian bytes.
str | binary data to output as bits |
Definition at line 77 of file bitdump.cpp.
References tlx::bitdump_be8().
std::string tlx::bitdump_be8_type | ( | const Type & | t | ) |
Dump a (binary) item as a sequence of 8-bit big-endian bytes.
t | binary data to output as bits |
Definition at line 81 of file bitdump.hpp.
References tlx::bitdump_be8().
std::string bitdump_le8 | ( | const void *const | data, |
size_t | size | ||
) |
Dump a (binary) string as a sequence of 8-bit little-endian bytes.
data | binary data to output as bits |
size | length of binary data |
Definition at line 18 of file bitdump.cpp.
Referenced by tlx::bitdump_le8(), and tlx::bitdump_le8_type().
std::string bitdump_le8 | ( | const std::string & | str | ) |
Dump a (binary) string as a sequence of 8-bit little-endian bytes.
str | binary data to output as bits |
Definition at line 44 of file bitdump.cpp.
References tlx::bitdump_le8().
std::string tlx::bitdump_le8_type | ( | const Type & | t | ) |
Dump a (binary) item as a sequence of 8-bit little-endian bytes.
t | binary data to output as bits |
Definition at line 51 of file bitdump.hpp.
References tlx::bitdump_be8(), and tlx::bitdump_le8().
int compare_icase | ( | const char * | a, |
const char * | b | ||
) |
returns +1/0/-1 like strcmp(a, b) but without regard for letter case
Definition at line 18 of file compare_icase.cpp.
References tlx::to_lower().
int compare_icase | ( | const char * | a, |
const std::string & | b | ||
) |
returns +1/0/-1 like strcmp(a, b) but without regard for letter case
Definition at line 35 of file compare_icase.cpp.
References tlx::to_lower().
int compare_icase | ( | const std::string & | a, |
const char * | b | ||
) |
returns +1/0/-1 like strcmp(a, b) but without regard for letter case
Definition at line 54 of file compare_icase.cpp.
References tlx::to_lower().
int compare_icase | ( | const std::string & | a, |
const std::string & | b | ||
) |
returns +1/0/-1 like strcmp(a, b) but without regard for letter case
Definition at line 72 of file compare_icase.cpp.
References tlx::to_lower().
bool contains | ( | const std::string & | str, |
const std::string & | pattern | ||
) |
Tests of string contains pattern.
Definition at line 15 of file contains.cpp.
bool contains | ( | const std::string & | str, |
const char * | pattern | ||
) |
Tests of string contains pattern.
Definition at line 19 of file contains.cpp.
bool contains | ( | const std::string & | str, |
const char | ch | ||
) |
Tests of string contains character.
Definition at line 23 of file contains.cpp.
bool contains_word | ( | const std::string & | str, |
const char * | word | ||
) |
Search the given string for a whitespace-delimited word.
It works as if the str was split_words() and the resulting vector checked for a given word. However this function does not create a vector, it scans the string directly. Whitespace is space, tab, newline or carriage-return.
str | whitespace-delimited string to check |
word | word to find |
Definition at line 19 of file contains_word.cpp.
References tlx::is_white().
Referenced by tlx::union_words().
bool contains_word | ( | const std::string & | str, |
const std::string & | word | ||
) |
Search the given string for a whitespace-delimited word.
It works as if the str was split_words() and the resulting vector checked for a given word. However this function does not create a vector, it scans the string directly. Whitespace is space, tab, newline or carriage-return.
str | whitespace-delimited string to check |
word | word to find |
Definition at line 55 of file contains_word.cpp.
References tlx::is_white().
bool ends_with | ( | const char * | str, |
const char * | match | ||
) |
Checks if the given match string is located at the end of this string.
Definition at line 22 of file ends_with.cpp.
Referenced by thrill::vfs::IsCompressed(), thrill::vfs::OpenReadStream(), thrill::vfs::OpenWriteStream(), thrill::vfs::SysOpenReadStream(), and thrill::vfs::SysOpenWriteStream().
bool ends_with | ( | const char * | str, |
const std::string & | match | ||
) |
Checks if the given match string is located at the end of this string.
Definition at line 38 of file ends_with.cpp.
bool ends_with | ( | const std::string & | str, |
const char * | match | ||
) |
Checks if the given match string is located at the end of this string.
Definition at line 53 of file ends_with.cpp.
bool ends_with | ( | const std::string & | str, |
const std::string & | match | ||
) |
Checks if the given match string is located at the end of this string.
Definition at line 66 of file ends_with.cpp.
bool ends_with_icase | ( | const std::string & | str, |
const char * | match | ||
) |
Checks if the given match string is located at the end of this string.
Compares the characters case-insensitively.
Checks if the given match string is located at the end of this string. Compares the characters case-insensitively.
Checks if the given match string is located at the end of this string. Compares the characters case-insensitively.
Definition at line 106 of file ends_with.cpp.
References tlx::to_lower().
bool ends_with_icase | ( | const std::string & | str, |
const std::string & | match | ||
) |
Checks if the given match string is located at the end of this string.
Compares the characters case-insensitively.
Definition at line 119 of file ends_with.cpp.
References tlx::to_lower().
bool equal_icase | ( | const char * | a, |
const char * | b | ||
) |
returns true if a == b without regard for letter case
Definition at line 18 of file equal_icase.cpp.
References tlx::to_lower().
Referenced by tlx::index_of_icase().
bool equal_icase | ( | const char * | a, |
const std::string & | b | ||
) |
returns true if a == b without regard for letter case
Definition at line 26 of file equal_icase.cpp.
References tlx::to_lower().
bool equal_icase | ( | const std::string & | a, |
const char * | b | ||
) |
returns true if a == b without regard for letter case
Definition at line 35 of file equal_icase.cpp.
References tlx::to_lower().
bool equal_icase | ( | const std::string & | a, |
const std::string & | b | ||
) |
returns true if a == b without regard for letter case
Definition at line 44 of file equal_icase.cpp.
References tlx::to_lower().
std::string & erase_all | ( | std::string * | str, |
char | drop = ' ' |
||
) |
Remove all occurrences of the given character in-place.
str | string to process |
drop | remove this character |
Definition at line 18 of file erase_all.cpp.
Referenced by tlx::erase_all().
std::string & erase_all | ( | std::string * | str, |
const char * | drop | ||
) |
Remove all occurrences of the given characters in-place.
str | string to process |
drop | remove these characters |
Definition at line 34 of file erase_all.cpp.
std::string & erase_all | ( | std::string * | str, |
const std::string & | drop | ||
) |
Remove all occurrences of the given characters in-place.
str | string to process |
drop | remove these characters |
Definition at line 50 of file erase_all.cpp.
References tlx::erase_all().
std::string erase_all | ( | const std::string & | str, |
char | drop = ' ' |
||
) |
Remove all occurrences of the given character, return copy of string.
str | string to process |
drop | remove this character |
Definition at line 57 of file erase_all.cpp.
std::string erase_all | ( | const std::string & | str, |
const char * | drop | ||
) |
Remove all occurrences of the given characters, return copy of string.
str | string to process |
drop | remove these characters |
Definition at line 71 of file erase_all.cpp.
std::string erase_all | ( | const std::string & | str, |
const std::string & | drop | ||
) |
Remove all occurrences of the given characters, return copy of string.
str | string to process |
drop | remove these characters |
Definition at line 92 of file erase_all.cpp.
References tlx::erase_all().
std::string escape_html | ( | const std::string & | str | ) |
Escape characters for inclusion in HTML documents: replaces the characters <, >, & and " with HTML entities.
Definition at line 17 of file escape_html.cpp.
std::string escape_html | ( | const char * | str | ) |
Escape characters for inclusion in HTML documents: replaces the characters <, >, & and " with HTML entities.
Definition at line 33 of file escape_html.cpp.
std::string escape_uri | ( | const std::string & | str | ) |
Escape a string into a URI-encoding.
This maps all non A-Z0-9 characters to HH hex representation.
Definition at line 17 of file escape_uri.cpp.
std::string escape_uri | ( | const char * | str | ) |
Escape a string into a URI-encoding.
This maps all non A-Z0-9 characters to HH hex representation.
Definition at line 57 of file escape_uri.cpp.
std::string & expand_environment_variables | ( | std::string * | s | ) |
Expand substrings $ABC_123 and ${ABC_123} into the corresponding environment variables.
Matches all substrings "$[a-zA-Z_][a-zA-Z0-9_]*" and "${[^}]*}". Replaces all substrings in-place.
Definition at line 19 of file expand_environment_variables.cpp.
Referenced by tlx::expand_environment_variables(), and disk_config::parse_line().
std::string expand_environment_variables | ( | const std::string & | s | ) |
Expand substrings $ABC_123 and ${ABC_123} into the corresponding environment variables.
Matches all substrings "$[a-zA-Z_][a-zA-Z0-9_]*" and "${[^}]*}". Returns a copy of the string with all substrings replaced.
Definition at line 80 of file expand_environment_variables.cpp.
References tlx::expand_environment_variables().
std::string expand_environment_variables | ( | const char * | s | ) |
Expand substrings $ABC_123 and ${ABC_123} into the corresponding environment variables.
Matches all substrings "$[a-zA-Z_][a-zA-Z0-9_]*" and "${[^}]*}". Returns a copy of the string with all substrings replaced.
Definition at line 86 of file expand_environment_variables.cpp.
References tlx::expand_environment_variables().
std::string extract_between | ( | const std::string & | str, |
const char * | sep1, | ||
const char * | sep2 | ||
) |
Search the string for given start and end separators and extract all characters between the both, if they are found.
Otherwise return an empty string.
str | string to search in |
sep1 | start boundary |
sep2 | end boundary |
Definition at line 37 of file extract_between.cpp.
References tlx::extract_between_template().
std::string extract_between | ( | const std::string & | str, |
const char * | sep1, | ||
const std::string & | sep2 | ||
) |
Search the string for given start and end separators and extract all characters between the both, if they are found.
Otherwise return an empty string.
str | string to search in |
sep1 | start boundary |
sep2 | end boundary |
Definition at line 42 of file extract_between.cpp.
References tlx::extract_between_template().
std::string extract_between | ( | const std::string & | str, |
const std::string & | sep1, | ||
const char * | sep2 | ||
) |
Search the string for given start and end separators and extract all characters between the both, if they are found.
Otherwise return an empty string.
str | string to search in |
sep1 | start boundary |
sep2 | end boundary |
Definition at line 47 of file extract_between.cpp.
References tlx::extract_between_template().
std::string extract_between | ( | const std::string & | str, |
const std::string & | sep1, | ||
const std::string & | sep2 | ||
) |
Search the string for given start and end separators and extract all characters between the both, if they are found.
Otherwise return an empty string.
str | string to search in |
sep1 | start boundary |
sep2 | end boundary |
Definition at line 52 of file extract_between.cpp.
References tlx::extract_between_template().
std::string format_iec_units | ( | uint64_t | number, |
int | precision = 3 |
||
) |
Format number as something like 1 TiB.
Format a byte size using IEC (Ki, Mi, Gi, Ti) suffixes (powers of two). Returns "123 Ki" or similar.
Definition at line 38 of file format_si_iec_units.cpp.
Referenced by foxxll::add_IEC_binary_multiplier(), Context::Launch(), main(), MemoryConfig::print(), scoped_print_iostats::report(), and scoped_print_timer::~scoped_print_timer().
std::string format_si_units | ( | uint64_t | number, |
int | precision = 3 |
||
) |
Format number as something like 1 TB.
Format a byte size using SI (K, M, G, T) suffixes (powers of ten). Returns "123 M" or similar.
Definition at line 19 of file format_si_iec_units.cpp.
Referenced by foxxll::add_SI_multiplier().
|
inlinestatic |
Simple, fast, but "insecure" string hash method by Dan Bernstein from http://www.cse.yorku.ca/~oz/hash.html.
Definition at line 26 of file hash_djb2.hpp.
Referenced by MultiTimer::find_or_create(), tlx::hash_djb2(), hash< tlx::StringView >::operator()(), and MultiTimer::start().
|
inlinestatic |
Simple, fast, but "insecure" string hash method by Dan Bernstein from http://www.cse.yorku.ca/~oz/hash.html.
Definition at line 41 of file hash_djb2.hpp.
References tlx::hash_djb2().
|
inlinestatic |
Simple, fast, but "insecure" string hash method by Dan Bernstein from http://www.cse.yorku.ca/~oz/hash.html.
Definition at line 50 of file hash_djb2.hpp.
|
inlinestatic |
Simple, fast, but "insecure" string hash method by Dan Bernstein from http://www.cse.yorku.ca/~oz/hash.html.
Definition at line 64 of file hash_djb2.hpp.
References tlx::hash_djb2().
|
inlinestatic |
Simple, fast, but "insecure" string hash method by Dan Bernstein from http://www.cse.yorku.ca/~oz/hash.html.
Definition at line 73 of file hash_djb2.hpp.
References tlx::hash_djb2().
|
inlinestatic |
Simple, fast, but "insecure" string hash method by sdbm database from http://www.cse.yorku.ca/~oz/hash.html.
Definition at line 26 of file hash_sdbm.hpp.
Referenced by tlx::hash_sdbm().
|
inlinestatic |
Simple, fast, but "insecure" string hash method by sdbm database from http://www.cse.yorku.ca/~oz/hash.html.
Definition at line 40 of file hash_sdbm.hpp.
References tlx::hash_sdbm().
|
inlinestatic |
Simple, fast, but "insecure" string hash method by sdbm database from http://www.cse.yorku.ca/~oz/hash.html.
Definition at line 49 of file hash_sdbm.hpp.
|
inlinestatic |
Simple, fast, but "insecure" string hash method by sdbm database from http://www.cse.yorku.ca/~oz/hash.html.
Definition at line 63 of file hash_sdbm.hpp.
References tlx::hash_sdbm().
|
inlinestatic |
Simple, fast, but "insecure" string hash method by sdbm database from http://www.cse.yorku.ca/~oz/hash.html.
Definition at line 72 of file hash_sdbm.hpp.
References tlx::hash_sdbm().
std::string hexdump | ( | const void *const | data, |
size_t | size | ||
) |
Dump a (binary) string as a sequence of uppercase hexadecimal pairs.
data | binary data to output in hex |
size | length of binary data |
Definition at line 21 of file hexdump.cpp.
Referenced by StreamSink::AppendPinnedBlock(), MD5::digest_hex_uc(), SHA1::digest_hex_uc(), SHA512::digest_hex_uc(), SHA256::digest_hex_uc(), tlx::hexdump(), tlx::hexdump_type(), Group::MaybeHexdump(), Socket::MaybeHexdump(), and CatStreamData::OnStreamBlock().
std::string hexdump | ( | const std::string & | str | ) |
Dump a (binary) string as a sequence of uppercase hexadecimal pairs.
str | binary data to output in hex |
Definition at line 42 of file hexdump.cpp.
References tlx::hexdump().
std::string hexdump | ( | const std::vector< char > & | data | ) |
Dump a char vector as a sequence of uppercase hexadecimal pairs.
data | binary data to output in hex |
Definition at line 46 of file hexdump.cpp.
References tlx::hexdump().
std::string hexdump | ( | const std::vector< uint8_t > & | data | ) |
Dump a uint8_t vector as a sequence of uppercase hexadecimal pairs.
data | binary data to output in hex |
Definition at line 50 of file hexdump.cpp.
References tlx::hexdump().
std::string hexdump_lc | ( | const void *const | data, |
size_t | size | ||
) |
Dump a (binary) string as a sequence of lowercase hexadecimal pairs.
data | binary data to output in hex |
size | length of binary data |
Definition at line 95 of file hexdump.cpp.
Referenced by MD5::digest_hex(), SHA1::digest_hex(), SHA512::digest_hex(), SHA256::digest_hex(), tlx::hexdump_lc(), tlx::hexdump_lc_type(), and tlx::hexdump_type().
std::string hexdump_lc | ( | const std::string & | str | ) |
Dump a (binary) string as a sequence of lowercase hexadecimal pairs.
str | binary data to output in hex |
Definition at line 116 of file hexdump.cpp.
References tlx::hexdump_lc().
std::string hexdump_lc | ( | const std::vector< char > & | data | ) |
Dump a char vector as a sequence of lowercase hexadecimal pairs.
data | binary data to output in hex |
Definition at line 120 of file hexdump.cpp.
References tlx::hexdump_lc().
std::string hexdump_lc | ( | const std::vector< uint8_t > & | data | ) |
Dump a uint8_t vector as a sequence of lowercase hexadecimal pairs.
data | binary data to output in hex |
Definition at line 124 of file hexdump.cpp.
References tlx::hexdump_lc().
std::string tlx::hexdump_lc_type | ( | const Type & | t | ) |
Dump a (binary) item as a sequence of lowercase hexadecimal pairs.
t | binary data to output in hex |
Definition at line 110 of file hexdump.hpp.
References tlx::hexdump_lc(), and tlx::parse_hexdump().
std::string hexdump_sourcecode | ( | const std::string & | str, |
const std::string & | var_name = "name" |
||
) |
Dump a (binary) string into a C source code snippet.
The snippet defines an array of const uint8_t* holding the data of the string.
str | string to output as C source array |
var_name | name of the array variable in the outputted code snippet |
Definition at line 54 of file hexdump.cpp.
Referenced by tlx::hexdump_type().
std::string tlx::hexdump_type | ( | const Type & | t | ) |
Dump a (binary) item as a sequence of uppercase hexadecimal pairs.
t | binary data to output in hex |
Definition at line 52 of file hexdump.hpp.
References tlx::hexdump(), tlx::hexdump_lc(), and tlx::hexdump_sourcecode().
Referenced by BlockReader< CatBlockSource >::Next(), SSTreeBuilderPreAndLevelOrder< key_type, num_splitters >::recurse(), and SSTreeBuilderLevelOrder< key_type, num_splitters >::recurse().
size_t index_of | ( | const std::vector< std::string > & | list, |
const char * | str | ||
) |
Attempts to find str in the list and return the index.
Throws a std::runtime_error if it is not found.
Definition at line 19 of file index_of.cpp.
size_t index_of | ( | const std::vector< std::string > & | list, |
const std::string & | str | ||
) |
Attempts to find str in the list and return the index.
Throws a std::runtime_error if it is not found.
Definition at line 29 of file index_of.cpp.
size_t index_of_icase | ( | const std::vector< std::string > & | list, |
const char * | str | ||
) |
Attempts to find str in the list and return the index using case-insensitive comparisons.
Throws a std::runtime_error if it is not found.
Definition at line 39 of file index_of.cpp.
References tlx::equal_icase().
size_t index_of_icase | ( | const std::vector< std::string > & | list, |
const std::string & | str | ||
) |
Attempts to find str in the list and return the index using case-insensitive comparisons.
Throws a std::runtime_error if it is not found.
Definition at line 50 of file index_of.cpp.
References tlx::equal_icase().
std::string join | ( | char | glue, |
const std::vector< std::string > & | parts | ||
) |
Join a vector of strings by some glue character between each pair from the sequence.
glue | character for glue |
parts | the vector of strings to join |
Definition at line 16 of file join.cpp.
Referenced by tlx::join(), thrill::data::operator<<(), examples::page_rank::PageRank(), examples::page_rank::PageRankJoin(), tlx::parallel_multiway_merge_base(), ByteBlock::pin_count_str(), ReadBinaryNode< ValueType >::ReadBinaryNode(), ReadLinesNode::ReadLinesNode(), and ThreadPool::~ThreadPool().
std::string join | ( | const char * | glue, |
const std::vector< std::string > & | parts | ||
) |
Join a vector of strings by some glue string between each pair from the sequence.
glue | string to glue |
parts | the vector of strings to join |
Definition at line 20 of file join.cpp.
References tlx::join().
std::string join | ( | const std::string & | glue, |
const std::vector< std::string > & | parts | ||
) |
Join a vector of strings by some glue string between each pair from the sequence.
glue | string to glue |
parts | the vector of strings to join |
Definition at line 24 of file join.cpp.
References tlx::join().
|
inlinestatic |
Join a sequence of strings by some glue string between each pair from the sequence.
The sequence in given as a range between two iterators.
glue | string to glue |
first | the beginning iterator of the range to join |
last | the ending iterator of the range to join |
Definition at line 35 of file join_generic.hpp.
|
inlinestatic |
Join a Container of strings by some glue character between each pair from the sequence.
glue | character for glue |
parts | the vector of strings to join |
Definition at line 62 of file join_generic.hpp.
References tlx::join().
|
inlinestatic |
Join a Container of strings by some glue string between each pair from the sequence.
glue | string to glue |
parts | the vector of strings to join |
Definition at line 76 of file join_generic.hpp.
References tlx::join().
|
inlinestatic |
Join a Container of strings by some glue string between each pair from the sequence.
glue | string to glue |
parts | the vector of strings to join |
Definition at line 90 of file join_generic.hpp.
References tlx::join().
std::string join_quoted | ( | const std::vector< std::string > & | str, |
char | sep, | ||
char | quote, | ||
char | escape | ||
) |
Join a vector of strings using a separator character.
If any string contains the separator, quote the field. In the quoted string, escape all quotes, escapes, \n, \r, \t sequences. This is the opposite of split_quoted().
Definition at line 15 of file join_quoted.cpp.
Referenced by tlx::join_quoted().
std::string join_quoted | ( | const std::vector< std::string > & | str | ) |
Join a vector of strings using spaces as separator character.
If any string contains a space, quote the field. In the quoted string, escape all quotes, escapes, \n, \r, \t sequences. This is the opposite of split_quoted().
Definition at line 55 of file join_quoted.cpp.
References tlx::join_quoted().
bool less_icase | ( | const char * | a, |
const char * | b | ||
) |
returns true if a < b without regard for letter case
Definition at line 18 of file less_icase.cpp.
References tlx::to_lower().
Referenced by less_icase_asc::operator()(), and less_icase_desc::operator()().
bool less_icase | ( | const char * | a, |
const std::string & | b | ||
) |
returns true if a < b without regard for letter case
Definition at line 33 of file less_icase.cpp.
References tlx::to_lower().
bool less_icase | ( | const std::string & | a, |
const char * | b | ||
) |
returns true if a < b without regard for letter case
Definition at line 49 of file less_icase.cpp.
References tlx::to_lower().
bool less_icase | ( | const std::string & | a, |
const std::string & | b | ||
) |
returns true if a < b without regard for letter case
Definition at line 65 of file less_icase.cpp.
References tlx::to_lower().
|
inlinestatic |
Computes the Levenshtein string distance between two strings.
The distance is the minimum number of replacements/inserts/deletes needed to change one string into the other.
a | first string |
b | second string |
Definition at line 128 of file levenshtein.hpp.
|
inlinestatic |
Computes the Levenshtein string distance between two strings.
The distance is the minimum number of replacements/inserts/deletes needed to change one string into the other.
a | first string |
b | second string |
Definition at line 156 of file levenshtein.hpp.
|
inlinestatic |
Computes the Levenshtein string distance also called edit distance between two strings.
The distance is the minimum number of replacements/inserts/deletes needed to change one string into the other. Implemented with time complexity O(|n|+|m|) and memory complexity O(2*max(|n|,|m|))
a | first string |
a_size | size of first string |
b | second string |
b_size | size of second string |
Definition at line 67 of file levenshtein.hpp.
References min(), and tlx::swap().
|
inlinestatic |
Computes the Levenshtein string distance between two strings.
The distance is the minimum number of replacements/inserts/deletes needed to change one string into the other.
a | first string |
b | second string |
Definition at line 142 of file levenshtein.hpp.
|
inlinestatic |
Computes the Levenshtein string distance between two strings.
The distance is the minimum number of replacements/inserts/deletes needed to change one string into the other. Character comparison is done case-insensitively.
a | first string |
b | second string |
Definition at line 171 of file levenshtein.hpp.
std::string pad | ( | const std::string & | s, |
size_t | len, | ||
char | pad_char | ||
) |
std::string parse_hexdump | ( | const std::string & | str | ) |
Read a string as a sequence of hexadecimal pairs.
Converts each pair of hexadecimal digits into a byte of the output string. Throws std::runtime_error() if an unknown letter is encountered.
str | string to parse as hex digits |
Definition at line 131 of file hexdump.cpp.
Referenced by tlx::hexdump_lc_type().
bool parse_si_iec_units | ( | const char * | str, |
uint64_t * | out_size, | ||
char | default_unit = 0 |
||
) |
Parse a string like "343KB" or "44 GiB" into the corresponding size in bytes.
Returns the number of bytes and sets ok = true if the string could be parsed correctly. If no units indicator is given, use def_unit in k/m/g/t/p (powers of ten) or in K/M/G/T/P (power of two).
Definition at line 17 of file parse_si_iec_units.cpp.
Referenced by main(), disk_config::parse_line(), tlx::parse_si_iec_units(), and MemoryConfig::setup_detect().
bool parse_si_iec_units | ( | const std::string & | str, |
uint64_t * | out_size, | ||
char | default_unit = 0 |
||
) |
Parse a string like "343KB" or "44 GiB" into the corresponding size in bytes.
Returns the number of bytes and sets ok = true if the string could be parsed correctly. If no units indicator is given, use def_unit in k/m/g/t/p (powers of ten) or in K/M/G/T/P (power of two).
Definition at line 88 of file parse_si_iec_units.cpp.
References tlx::parse_si_iec_units().
std::string & replace_all | ( | std::string * | str, |
const std::string & | needle, | ||
const std::string & | instead | ||
) |
Replace all occurrences of needle in str.
Each needle will be replaced with instead, if found. The replacement is done in the given string and a reference to the same is returned.
str | the string to process |
needle | string to search for in str |
instead | replace needle with instead |
Definition at line 141 of file replace.cpp.
Referenced by thrill::common::LogCmdlineParams().
std::string & replace_all | ( | std::string * | str, |
const std::string & | needle, | ||
const char * | instead | ||
) |
Replace all occurrences of needle in str.
Each needle will be replaced with instead, if found. The replacement is done in the given string and a reference to the same is returned.
str | the string to process |
needle | string to search for in str |
instead | replace needle with instead |
Definition at line 154 of file replace.cpp.
std::string & replace_all | ( | std::string * | str, |
const char * | needle, | ||
const std::string & | instead | ||
) |
Replace all occurrences of needle in str.
Each needle will be replaced with instead, if found. The replacement is done in the given string and a reference to the same is returned.
str | the string to process |
needle | string to search for in str |
instead | replace needle with instead |
Definition at line 168 of file replace.cpp.
std::string & replace_all | ( | std::string * | str, |
const char * | needle, | ||
const char * | instead | ||
) |
Replace all occurrences of needle in str.
Each needle will be replaced with instead, if found. The replacement is done in the given string and a reference to the same is returned.
str | the string to process |
needle | string to search for in str |
instead | replace needle with instead |
Definition at line 182 of file replace.cpp.
std::string & replace_all | ( | std::string * | str, |
char | needle, | ||
char | instead | ||
) |
Replace all occurrences of needle in str.
Each needle will be replaced with instead, if found. The replacement is done in the given string and a reference to the same is returned.
str | the string to process |
needle | character to search for in str |
instead | replace needle with instead |
Definition at line 197 of file replace.cpp.
std::string replace_all | ( | const std::string & | str, |
const std::string & | needle, | ||
const std::string & | instead | ||
) |
Replace all occurrences of needle in str.
Each needle will be replaced with instead, if found. Returns a copy of the string with possible replacements.
str | the string to process |
needle | string to search for in str |
instead | replace needle with instead |
Definition at line 212 of file replace.cpp.
std::string replace_all | ( | const std::string & | str, |
const std::string & | needle, | ||
const char * | instead | ||
) |
Replace all occurrences of needle in str.
Each needle will be replaced with instead, if found. Returns a copy of the string with possible replacements.
str | the string to process |
needle | string to search for in str |
instead | replace needle with instead |
Definition at line 227 of file replace.cpp.
std::string replace_all | ( | const std::string & | str, |
const char * | needle, | ||
const std::string & | instead | ||
) |
Replace all occurrences of needle in str.
Each needle will be replaced with instead, if found. Returns a copy of the string with possible replacements.
str | the string to process |
needle | string to search for in str |
instead | replace needle with instead |
Definition at line 242 of file replace.cpp.
std::string replace_all | ( | const std::string & | str, |
const char * | needle, | ||
const char * | instead | ||
) |
Replace all occurrences of needle in str.
Each needle will be replaced with instead, if found. Returns a copy of the string with possible replacements.
str | the string to process |
needle | string to search for in str |
instead | replace needle with instead |
Definition at line 257 of file replace.cpp.
std::string replace_all | ( | const std::string & | str, |
char | needle, | ||
char | instead | ||
) |
Replace all occurrences of needle in str.
Each needle will be replaced with instead, if found. Returns a copy of the string with possible replacements.
str | the string to process |
needle | character to search for in str |
instead | replace needle with instead |
Definition at line 273 of file replace.cpp.
std::string & replace_first | ( | std::string * | str, |
const std::string & | needle, | ||
const std::string & | instead | ||
) |
Replace only the first occurrence of needle in str.
The needle will be replaced with instead, if found. The replacement is done in the given string and a reference to the same is returned.
str | the string to process |
needle | string to search for in str |
instead | replace needle with instead |
Definition at line 21 of file replace.cpp.
std::string & replace_first | ( | std::string * | str, |
const std::string & | needle, | ||
const char * | instead | ||
) |
Replace only the first occurrence of needle in str.
The needle will be replaced with instead, if found. The replacement is done in the given string and a reference to the same is returned.
str | the string to process |
needle | string to search for in str |
instead | replace needle with instead |
Definition at line 32 of file replace.cpp.
std::string & replace_first | ( | std::string * | str, |
const char * | needle, | ||
const std::string & | instead | ||
) |
Replace only the first occurrence of needle in str.
The needle will be replaced with instead, if found. The replacement is done in the given string and a reference to the same is returned.
str | the string to process |
needle | string to search for in str |
instead | replace needle with instead |
Definition at line 43 of file replace.cpp.
std::string & replace_first | ( | std::string * | str, |
const char * | needle, | ||
const char * | instead | ||
) |
Replace only the first occurrence of needle in str.
The needle will be replaced with instead, if found. The replacement is done in the given string and a reference to the same is returned.
str | the string to process |
needle | string to search for in str |
instead | replace needle with instead |
Definition at line 54 of file replace.cpp.
std::string & replace_first | ( | std::string * | str, |
char | needle, | ||
char | instead | ||
) |
Replace only the first occurrence of needle in str.
The needle will be replaced with instead, if found. The replacement is done in the given string and a reference to the same is returned.
str | the string to process |
needle | character to search for in str |
instead | replace needle with instead |
Definition at line 65 of file replace.cpp.
std::string replace_first | ( | const std::string & | str, |
const std::string & | needle, | ||
const std::string & | instead | ||
) |
Replace only the first occurrence of needle in str.
The needle will be replaced with instead, if found. Returns a copy of the string with the possible replacement.
str | the string to process |
needle | string to search for in str |
instead | replace needle with instead |
Definition at line 78 of file replace.cpp.
std::string replace_first | ( | const std::string & | str, |
const std::string & | needle, | ||
const char * | instead | ||
) |
Replace only the first occurrence of needle in str.
The needle will be replaced with instead, if found. Returns a copy of the string with the possible replacement.
str | the string to process |
needle | string to search for in str |
instead | replace needle with instead |
Definition at line 91 of file replace.cpp.
std::string replace_first | ( | const std::string & | str, |
const char * | needle, | ||
const std::string & | instead | ||
) |
Replace only the first occurrence of needle in str.
The needle will be replaced with instead, if found. Returns a copy of the string with the possible replacement.
str | the string to process |
needle | string to search for in str |
instead | replace needle with instead |
Definition at line 103 of file replace.cpp.
std::string replace_first | ( | const std::string & | str, |
const char * | needle, | ||
const char * | instead | ||
) |
Replace only the first occurrence of needle in str.
The needle will be replaced with instead, if found. Returns a copy of the string with the possible replacement.
str | the string to process |
needle | string to search for in str |
instead | replace needle with instead |
Definition at line 115 of file replace.cpp.
std::string replace_first | ( | const std::string & | str, |
char | needle, | ||
char | instead | ||
) |
Replace only the first occurrence of needle in str.
The needle will be replaced with instead, if found. Returns a copy of the string with the possible replacement.
str | the string to process |
needle | character to search for in str |
instead | replace needle with instead |
Definition at line 127 of file replace.cpp.
std::vector< std::string > split | ( | char | sep, |
const std::string & | str, | ||
std::string::size_type | limit = std::string::npos |
||
) |
Split the given string at each separator character into distinct substrings.
Multiple consecutive separators are considered individually and will result in empty split substrings.
sep | separator character |
str | string to split |
limit | maximum number of parts returned |
Definition at line 20 of file split.cpp.
Referenced by tlx::multiway_merge_detail::equally_split(), BTree< key_type, value_type, key_of_value, key_compare, traits, true, allocator_type >::insert_descend(), JoinTPCH4(), tlx::parallel_mergesort_base(), disk_config::parse_fileio(), disk_config::parse_line(), Percentiles(), tlx::multiway_merge_detail::prepare_unguarded(), tlx::multiway_merge_detail::prepare_unguarded_sentinel(), thrill::api::RunBackendLoopback(), and tlx::split().
std::vector< std::string > split | ( | const char * | sep, |
const std::string & | str, | ||
std::string::size_type | limit = std::string::npos |
||
) |
Split the given string at each separator string into distinct substrings.
Multiple consecutive separators are considered individually and will result in empty split substrings.
sep | separator string |
str | string to split |
limit | maximum number of parts returned |
Definition at line 28 of file split.cpp.
References tlx::split().
std::vector< std::string > split | ( | const std::string & | sep, |
const std::string & | str, | ||
std::string::size_type | limit = std::string::npos |
||
) |
Split the given string at each separator string into distinct substrings.
Multiple consecutive separators are considered individually and will result in empty split substrings.
sep | separator string |
str | string to split |
limit | maximum number of parts returned |
Definition at line 36 of file split.cpp.
References tlx::split().
std::vector< std::string > split | ( | char | sep, |
const std::string & | str, | ||
std::string::size_type | min_fields, | ||
std::string::size_type | limit | ||
) |
Split the given string at each separator character into distinct substrings.
Multiple consecutive separators are considered individually and will result in empty split substrings. Returns a vector of strings with at least min_fields and at most limit_fields, empty fields are added if needed.
sep | separator string |
str | string to split |
min_fields | minimum number of parts returned |
limit | maximum number of parts returned |
Definition at line 47 of file split.cpp.
References tlx::split().
std::vector< std::string > split | ( | const char * | sep, |
const std::string & | str, | ||
std::string::size_type | min_fields, | ||
std::string::size_type | limit | ||
) |
Split the given string at each separator string into distinct substrings.
Multiple consecutive separators are considered individually and will result in empty split substrings. Returns a vector of strings with at least min_fields and at most limit_fields, empty fields are added if needed.
sep | separator string |
str | string to split |
min_fields | minimum number of parts returned |
limit | maximum number of parts returned |
Definition at line 56 of file split.cpp.
References tlx::split().
std::vector< std::string > split | ( | const std::string & | sep, |
const std::string & | str, | ||
std::string::size_type | min_fields, | ||
std::string::size_type | limit | ||
) |
Split the given string at each separator string into distinct substrings.
Multiple consecutive separators are considered individually and will result in empty split substrings. Returns a vector of strings with at least min_fields and at most limit_fields, empty fields are added if needed.
sep | separator string |
str | string to split |
min_fields | minimum number of parts returned |
limit | maximum number of parts returned |
Definition at line 65 of file split.cpp.
References tlx::split().
std::vector< std::string > & split | ( | std::vector< std::string > * | into, |
char | sep, | ||
const std::string & | str, | ||
std::string::size_type | limit = std::string::npos |
||
) |
Split the given string at each separator character into distinct substrings.
Multiple consecutive separators are considered individually and will result in empty split substrings.
into | destination std::vector |
sep | separator character |
str | string to split |
limit | maximum number of parts returned |
std::vector< std::string > & split | ( | std::vector< std::string > * | into, |
const char * | sep, | ||
const std::string & | str, | ||
std::string::size_type | limit = std::string::npos |
||
) |
Split the given string at each separator string into distinct substrings.
Multiple consecutive separators are considered individually and will result in empty split substrings.
into | destination std::vector |
sep | separator string |
str | string to split |
limit | maximum number of parts returned |
Definition at line 147 of file split.cpp.
References tlx::split().
std::vector< std::string > & split | ( | std::vector< std::string > * | into, |
const std::string & | sep, | ||
const std::string & | str, | ||
std::string::size_type | limit = std::string::npos |
||
) |
Split the given string at each separator string into distinct substrings.
Multiple consecutive separators are considered individually and will result in empty split substrings.
into | destination std::vector |
sep | separator string |
str | string to split |
limit | maximum number of parts returned |
Definition at line 155 of file split.cpp.
References tlx::split().
std::vector< std::string > & split | ( | std::vector< std::string > * | into, |
char | sep, | ||
const std::string & | str, | ||
std::string::size_type | min_fields, | ||
std::string::size_type | limit | ||
) |
Split the given string at each separator character into distinct substrings.
Multiple consecutive separators are considered individually and will result in empty split substrings. Returns a vector of strings with at least min_fields and at most limit_fields, empty fields are added if needed.
into | destination std::vector |
sep | separator character |
str | string to split |
min_fields | minimum number of parts returned |
limit | maximum number of parts returned |
Definition at line 166 of file split.cpp.
References tlx::split().
std::vector< std::string > & split | ( | std::vector< std::string > * | into, |
const char * | sep, | ||
const std::string & | str, | ||
std::string::size_type | min_fields, | ||
std::string::size_type | limit | ||
) |
Split the given string at each separator string into distinct substrings.
Multiple consecutive separators are considered individually and will result in empty split substrings. Returns a vector of strings with at least min_fields and at most limit_fields, empty fields are added if needed.
into | destination std::vector |
sep | separator string |
str | string to split |
min_fields | minimum number of parts returned |
limit | maximum number of parts returned |
Definition at line 179 of file split.cpp.
References tlx::split().
std::vector< std::string > & split | ( | std::vector< std::string > * | into, |
const std::string & | sep, | ||
const std::string & | str, | ||
std::string::size_type | min_fields, | ||
std::string::size_type | limit | ||
) |
Split the given string at each separator string into distinct substrings.
Multiple consecutive separators are considered individually and will result in empty split substrings. Returns a vector of strings with at least min_fields and at most limit_fields, empty fields are added if needed.
into | destination std::vector |
sep | separator string |
str | string to split |
min_fields | minimum number of parts returned |
limit | maximum number of parts returned |
Definition at line 192 of file split.cpp.
References tlx::split().
std::vector< std::string > split_quoted | ( | const std::string & | str, |
char | sep, | ||
char | quote, | ||
char | escape | ||
) |
Split the given string at each separator character into distinct substrings.
Multiple separators are joined and will not result in empty split substrings. Quoted fields extend to the next quote. Quoted fields may containg escaped quote, and \n \r \t \\ sequences.
Definition at line 18 of file split_quoted.cpp.
Referenced by tlx::split_quoted().
std::vector< std::string > split_quoted | ( | const std::string & | str | ) |
Split the given string at each space into distinct substrings.
Multiple spaces are joined and will not result in empty split substrings. Quoted fields extend to the next quote. Quoted fields may containg escaped quote, and \n \r \t \\ sequences.
Definition at line 122 of file split_quoted.cpp.
References tlx::split_quoted().
|
inlinestatic |
Split the given string at each separator character into distinct substrings, and call the given callback with a StringView for each substring.
Multiple consecutive separators are considered individually and will result in empty split substrings.
str | string to split |
sep | separator character |
callback | callback taking StringView of substring |
limit | maximum number of parts returned |
Definition at line 38 of file split_view.hpp.
Referenced by examples::word_count::HashWordCountExample(), main(), WordCount(), and examples::word_count::WordCount().
std::vector< std::string > split_words | ( | const std::string & | str, |
std::string::size_type | limit = std::string::npos |
||
) |
Split the given string by whitespaces into distinct words.
Multiple consecutive whitespaces are considered as one split point. Whitespaces are space, tab, newline and carriage-return.
str | string to split |
limit | maximum number of parts returned |
Definition at line 15 of file split_words.cpp.
std::string std::string ssnprintf | ( | size_t | max_size, |
const char * | fmt, | ||
... | |||
) |
Helper for return the result of a snprintf() call inside a std::string.
max_size | maximum length of output string, longer ones are truncated. |
fmt | printf format and additional parameters |
Definition at line 42 of file ssprintf.cpp.
Referenced by thrill::vfs::FillFilePattern().
String tlx::ssnprintf_generic | ( | size_t | max_size, |
const char * | fmt, | ||
... | |||
) |
Helper for return the result of a snprintf() call inside a string object.
max_size | maximum length of output string, longer ones are truncated. |
fmt | printf format and additional parameters |
Referenced by tlx::ssprintf_generic().
std::string ssprintf | ( | const char * | fmt, |
... | |||
) |
Helper for return the result of a sprintf() call inside a std::string.
fmt | printf format and additional parameters |
Definition at line 18 of file ssprintf.cpp.
Referenced by examples::suffix_sorting::ConstructWaveletTree(), RunJoinPageRankEdgePerLine(), RunPageRankEdgePerLine(), and RunPageRankJoinGenerated().
String tlx::ssprintf_generic | ( | const char * | fmt, |
... | |||
) |
Helper for return the result of a sprintf() call inside a string object.
fmt | printf format and additional parameters |
bool starts_with | ( | const char * | str, |
const char * | match | ||
) |
Checks if the given match string is located at the start of this string.
Definition at line 21 of file starts_with.cpp.
Referenced by thrill::vfs::Glob(), thrill::vfs::IsRemoteUri(), thrill::vfs::OpenReadStream(), and thrill::vfs::OpenWriteStream().
bool starts_with | ( | const char * | str, |
const std::string & | match | ||
) |
Checks if the given match string is located at the start of this string.
Definition at line 29 of file starts_with.cpp.
bool starts_with | ( | const std::string & | str, |
const char * | match | ||
) |
Checks if the given match string is located at the start of this string.
Definition at line 38 of file starts_with.cpp.
bool starts_with | ( | const std::string & | str, |
const std::string & | match | ||
) |
Checks if the given match string is located at the start of this string.
Definition at line 47 of file starts_with.cpp.
bool starts_with_icase | ( | const char * | str, |
const char * | match | ||
) |
Checks if the given match string is located at the start of this string.
Compares the characters case-insensitively.
Definition at line 55 of file starts_with.cpp.
References tlx::to_lower().
bool starts_with_icase | ( | const char * | str, |
const std::string & | match | ||
) |
Checks if the given match string is located at the start of this string.
Compares the characters case-insensitively.
Definition at line 64 of file starts_with.cpp.
References tlx::to_lower().
bool starts_with_icase | ( | const std::string & | str, |
const char * | match | ||
) |
Checks if the given match string is located at the start of this string.
Compares the characters case-insensitively.
Definition at line 73 of file starts_with.cpp.
References tlx::to_lower().
bool starts_with_icase | ( | const std::string & | str, |
const std::string & | match | ||
) |
Checks if the given match string is located at the start of this string.
Compares the characters case-insensitively.
Definition at line 83 of file starts_with.cpp.
References tlx::to_lower().
char to_lower | ( | char | ch | ) |
Transform the given character to lower case without any localization.
Definition at line 17 of file to_lower.cpp.
Referenced by LevenshteinStandardICaseParameters::char_equal(), tlx::compare_icase(), tlx::ends_with_icase(), tlx::equal_icase(), tlx::less_icase(), tlx::starts_with_icase(), and tlx::to_lower().
std::string & to_lower | ( | std::string * | str | ) |
Transforms the given string to lowercase and returns a reference to it.
str | string to process |
Definition at line 23 of file to_lower.cpp.
References tlx::to_lower().
std::string to_lower | ( | const std::string & | str | ) |
Returns a copy of the given string converted to lowercase.
str | string to process |
Definition at line 29 of file to_lower.cpp.
References tlx::to_lower().
char to_upper | ( | char | ch | ) |
Transform the given character to upper case without any localization.
Definition at line 17 of file to_upper.cpp.
Referenced by tlx::to_upper().
std::string & to_upper | ( | std::string * | str | ) |
Transforms the given string to uppercase and returns a reference to it.
str | string to process |
Definition at line 23 of file to_upper.cpp.
References tlx::to_upper().
std::string to_upper | ( | const std::string & | str | ) |
Returns a copy of the given string converted to uppercase.
str | string to process |
Definition at line 29 of file to_upper.cpp.
References tlx::to_upper().
std::string & trim | ( | std::string * | str | ) |
Trims the given string in-place on the left and right.
Removes all characters in the given drop array, which defaults to " \r\n\t".
str | string to process |
Definition at line 20 of file trim.cpp.
Referenced by tlx::trim().
std::string & trim | ( | std::string * | str, |
const char * | drop | ||
) |
std::string & trim | ( | std::string * | str, |
const std::string & | drop | ||
) |
std::string trim | ( | const std::string & | str | ) |
Trims the given string in-place on the left and right.
Removes all characters in the given drop array, which defaults to " \r\n\t".
str | string to process |
Definition at line 50 of file trim.cpp.
References tlx::trim().
std::string trim | ( | const std::string & | str, |
const char * | drop | ||
) |
std::string trim | ( | const std::string & | str, |
const std::string & | drop | ||
) |
std::string & trim_left | ( | std::string * | str | ) |
Trims the given string in-place only on the left.
Removes all characters in the given drop array, which defaults to " \r\n\t".
str | string to process |
Definition at line 128 of file trim.cpp.
Referenced by tlx::trim_left().
std::string & trim_left | ( | std::string * | str, |
const char * | drop | ||
) |
std::string & trim_left | ( | std::string * | str, |
const std::string & | drop | ||
) |
std::string trim_left | ( | const std::string & | str | ) |
Trims the given string only on the left.
Removes all characters in the given drop array, which defaults to " \r\n\t". Returns a copy of the string.
str | string to process |
Definition at line 142 of file trim.cpp.
References tlx::trim_left().
std::string trim_left | ( | const std::string & | str, |
const char * | drop | ||
) |
std::string trim_left | ( | const std::string & | str, |
const std::string & | drop | ||
) |
std::string & trim_right | ( | std::string * | str | ) |
Trims the given string in-place only on the right.
Removes all characters in the given drop array, which defaults to " \r\n\t".
str | string to process |
Definition at line 94 of file trim.cpp.
Referenced by tlx::trim_right().
std::string & trim_right | ( | std::string * | str, |
const char * | drop | ||
) |
std::string & trim_right | ( | std::string * | str, |
const std::string & | drop | ||
) |
std::string trim_right | ( | const std::string & | str | ) |
Trims the given string only on the right.
Removes all characters in the given drop array, which defaults to " \r\n\t". Returns a copy of the string.
str | string to process |
Definition at line 108 of file trim.cpp.
References tlx::trim_right().
std::string trim_right | ( | const std::string & | str, |
const char * | drop | ||
) |
std::string trim_right | ( | const std::string & | str, |
const std::string & | drop | ||
) |
std::string union_words | ( | const std::string & | wordsA, |
const std::string & | wordsB | ||
) |
Return union of two keyword sets.
Definition at line 16 of file union_words.cpp.
References tlx::contains_word().
std::string word_wrap | ( | const std::string & | str, |
unsigned int | wrap = 80 |
||
) |
Try to wrap a string to 80 columns without split words.
All newlines are kept, new newline characters are inserted only at spaces, hence, words are never split. If words longer than 80 columns occur they are NOT broken.
Definition at line 22 of file word_wrap.cpp.
References tlx::is_space().