StringUtil.h 975 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef STRINGUTIL_H_
  2. #define STRINGUTIL_H_
  3. namespace gameplay
  4. {
  5. /**
  6. * Returns true if the given string starts with the prefix.
  7. */
  8. bool startsWith(const char* str, const char* prefix, bool ignoreCase = true);
  9. /**
  10. * Returns true if the given string ends with the suffix.
  11. */
  12. bool endsWith(const char* str, const char* suffix, bool ignoreCase = true);
  13. bool endsWith(const std::string& str, const char* suffix, bool ignoreCase = true);
  14. /**
  15. * Return true if the strings are equal. Case sensitive.
  16. */
  17. bool equals(const std::string& a, const char* b);
  18. bool equals(const std::string& a, const std::string& b);
  19. /**
  20. * Returns true if the strings are equal. Case insensitive.
  21. */
  22. bool equalsIgnoreCase(const std::string& a, const char* b);
  23. /**
  24. * Returns the filename from the given real path.
  25. */
  26. std::string getFilenameFromFilePath(const std::string& filepath);
  27. std::string getFilenameNoExt(const std::string& filename);
  28. }
  29. #endif