Boost:StringAlgo
lastmod 2018-08-17created 2015-04-023 edits
How to use
The following header must be included.
Example
-
to_upper(std::string): Convert to uppercase -
to_lower(std::string): Convert to lowercase -
trim(std::string): Remove whitespace characters -
iends_with(std::string, ".exe"): Check whether the string ends with .exe -
find_first(std::string, "dolly"): Does the string contain dolly? (returns iterator or bool) -
replace_first(std::string, "A", "B"): Search from the front and replace A with B (once) -
replace_last(std::string, "A", "B"): Search from the back and replace A with B (once) -
erase_all(std::string, "empty"): Delete all occurrences of the string empty -
erase_head(std::string, 6): Delete the first 6 characters -
split(std::vector<std::string>>, std::string, is_any_of("--"), token_compress_on)1: Find every "--" in the string and push_back the pieces into a vector<string> container
See also
Favorite site
References
-
Consider using Boost:Tokenizer. ↩