StringAlgorithm.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef STRINGALGORITHM_H
  2. #define STRINGALGORITHM_H
  3. #include <string>
  4. #include <vector>
  5. namespace StringAlgorithm {
  6. namespace Internal {
  7. size_t find_nth(const std::string& haystack, size_t pos, const std::string& needle, size_t nth);
  8. } // namespace Internal
  9. bool equals(const std::string& str1, const std::string& str2);
  10. bool iequals(const std::string& str1, const std::string& str2);
  11. bool starts_with(const std::string& subject, const std::string& string);
  12. bool istarts_with(const std::string& subject, const std::string& string);
  13. bool ends_with(const std::string& subject, const std::string& string);
  14. bool iends_with(const std::string& subject, const std::string& string);
  15. std::vector<std::string> split(const std::string& subject, const char& delimiter);
  16. std::vector<std::string> split(const std::string& subject, const std::string delimiters);
  17. void erase_all(std::string& subject, const char& item);
  18. bool contains(const std::string& subject, const std::string& find);
  19. bool icontains(const std::string& subject, const std::string& find);
  20. std::string::const_iterator find_nth(const std::string& haystack, const std::string& needle, size_t nth);
  21. bool is_numeric(const std::string& str);
  22. } // namespace StringAlgorithm
  23. #endif // STRINGALGORITHM_H