Easy to use, header only C++ 20 std::string utility library.
Any constructive comments and improvements to this little library are very welcome.
- Generic parsing methods - from std::string and to std::string.
- Splitting std::string to tokens with user defined delimiter (useful for CSV parsing) or regex expression.
- Joining split string that is stored in std::vectorstd::string with the specified delimiter.
- Replace a substring with another substring.
- Text manipulation functions: capitalize, repeat (char or std::string), to_lower, to_upper, trim, trim_left, trim_right (also in-place).
- Checks: contains, starts_with, ends_with, matches.
- Compare two std::string with their case ignored.
- Removing all empty strings in std::vectorstd::string (also in-place).
- Sorting in ascending/descending order elements in std::vectorstd::string.
- Header only library - no building required.
- Does not require any dependencies.
Online documentation can be found here.
Simply put strutil.h in your include directory. Then, in C++ file include it:
#include <strutil.h>
See tests/test_cases.cpp file for the example usage.
strutil supports the Google Test library (link).
To build the testing environment execute the following command in the root directory:
cmake -B build
All contributions are more than welcome.
Thank you all for your contributions!