Skip to content

Latest commit

 

History

History
55 lines (42 loc) · 1.53 KB

README.md

File metadata and controls

55 lines (42 loc) · 1.53 KB

StringFix

C++ helper for string manipulation (trim, to_lower, split, explode etc...). For in-depth explanation please see function description at: https://github.com/KjellKod/StringFix/blob/master/src/StringFix.cpp

Replace parts of string
size_t replace(std::string& input, const std::string& from, const std::string& to);
Trim the string based on whitespace or other character
std::string trim(const std::string& str, const std::string& whitespace = " \t");
To lower/upper
std::string to_lower(const std::string& str);
std::string to_upper(const std::string& str);
Bool to string
std::string to_string(const bool& b);
Split and Explode the string based on delimiters and match
std::vector<std::string> split(const std::string& split_on_any_delimiters, 
                               const std::string& stringToSplit)

std::vector<std::string> explode(const std::string& complete_match, 
                                 const std::string& stringToExplode);
Get elements that are matching
std::vector<std::string> extract(const std::string& complete_match_start, 
                                 const std::string& complete_match_end, const std::string& content);
Verify if vector contains an element
bool ContainsElement(const std::vector<std::string>& v, const std::string& s);
Extension handling
std::string remove_extension(const std::string& s);
std::string get_extension(const std::string& s);