Skip to content

tgalaj/strutil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status License: MIT

strutil

Easy to use, header only C++ 20 std::string utility library.

Any constructive comments and improvements to this little library are very welcome.

Features

  • 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.

Documentation

Online documentation can be found here.

Adding strutil to existing project

Simply put strutil.h in your include directory. Then, in C++ file include it:

#include <strutil.h>

Example usage

See tests/test_cases.cpp file for the example usage.

Testing

strutil supports the Google Test library (link).

To build the testing environment execute the following command in the root directory:

cmake -B build

Contributions

All contributions are more than welcome.

Thank you all for your contributions!