Functions | |
size_t | split (const std::string &input, const std::string &separator, std::vector< std::string > &output) throw () |
Split a string consisting of substrings separated by a separator string. | |
size_t | split_and_trim (const std::string &input, const std::string &separator, std::vector< std::string > &output) throw () |
Split and trim the results. | |
std::string & | tolower (std::string &s) throw () |
Change (in-place) all chars in string to lower case. | |
std::string & | toupper (std::string &s) throw () |
Change (in-place) all chars in string to upper case. | |
std::string & | trim (std::string &s) throw () |
Remove leading and trailing white noise (as defined by isspace(3)) The argument is changed and returned. | |
std::string | trim (const std::string &s) throw () |
Remove leading and trailing white noise (as defined by isspace(3)) The argument is changed and returned. | |
std::string & | despace (std::string &s, char c= '-') throw () |
Replace each space character in s by a given character. | |
char * | trim (char *pc) throw () |
Remove leading and trailing white noise (' ','\n','\t') from C string. |
size_t Dv::String::split | ( | const std::string & | input, | |
const std::string & | separator, | |||
std::vector< std::string > & | output | |||
) | throw () |
Split a string consisting of substrings separated by a separator string.
The substrings will be appended to the output vector.
input | string, e.g. 'abcXYZdefXYZ1234' (with 'XYZ' the separator string) | |
separator | string, e.g. 'XYZ' in the above example | |
output | vector, e.g. { 'abc', 'def', '1234' } |
Some borderline cases (each time with '/' as separator):
'/abc/def' yields { '', 'abc', 'def' } 'abc/def/1234' yields { 'abc', 'def', '1234' } 'abc/def/' yields { 'abc', 'def', '' }
size_t Dv::String::split_and_trim | ( | const std::string & | input, | |
const std::string & | separator, | |||
std::vector< std::string > & | output | |||
) | throw () |
Split and trim the results.
Split as in Dv::String::split and, in addition, trim the results before appending them to the vector.
input | string, e.g. 'abcXYZdefXYZ1234' (with 'XYZ' the separator string) | |
separator | string, e.g. 'XYZ' in the above example | |
output | vector, e.g. { 'abc', 'def', '1234' } |
std::string& Dv::String::tolower | ( | std::string & | s | ) | throw () |
Change (in-place) all chars in string to lower case.
s | string to convert. |
std::string& Dv::String::toupper | ( | std::string & | s | ) | throw () |
Change (in-place) all chars in string to upper case.
s | string to convert. |
std::string& Dv::String::trim | ( | std::string & | s | ) | throw () |
Remove leading and trailing white noise (as defined by isspace(3)) The argument is changed and returned.
s | string to trim |
std::string Dv::String::trim | ( | const std::string & | s | ) | throw () |
Remove leading and trailing white noise (as defined by isspace(3)) The argument is changed and returned.
s | string to trim |
std::string& Dv::String::despace | ( | std::string & | s, | |
char | c = '-' | |||
) | throw () |
Replace each space character in s by a given character.
A character x is a space character is isspace(x) is true.
s | string to despace | |
c | replacement char |
char* Dv::String::trim | ( | char * | pc | ) | throw () |
Remove leading and trailing white noise (' ','\n','\t') from C string.
pc | C-string to trim. |
char* pc = new char[10]; .. pc = trim(pc); delete[] pc;
dvutil-1.0.10 | [ 5 December, 2009] |