stringutils.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef STRINGUTILS_H
  2. #define STRINGUTILS_H
  3. /*
  4. * NICE-Core - efficient algebra and computer vision methods
  5. * - libfbasics - library of some basic tools
  6. * See file License for license information.
  7. */
  8. #include <vector>
  9. #include <string>
  10. namespace NICE {
  11. /** Convert the integer "integer" into a string.
  12. * @param integer integer to convert
  13. * @return string the integer string
  14. * @deprecated see numerictools.h
  15. **/
  16. std::string itostr(int integer);
  17. /** Split the string \c s into a vector of strings.
  18. * @param s input string
  19. * @param separator character to separate the string
  20. * @return vector of strings
  21. **/
  22. std::vector<std::string> splitString(const std::string &s, char separator);
  23. /** Split the string \c s into a vector of strings.
  24. * @param s input string
  25. * @param separator character to separate the string
  26. * @param result vector of strings
  27. **/
  28. void splitString(const std::string &s, char separator,
  29. std::vector<std::string>& result);
  30. /** Split the vector of strings \c inlist to a vector of vector of strings.
  31. * @param inlist input list of strings
  32. * @param separator character to separate the strings
  33. * @return vector of vector of strings
  34. **/
  35. std::vector<std::vector<std::string> > splitStringVector(
  36. const std::vector<std::string> &inlist,
  37. char separator);
  38. /**
  39. * Replace a certain character in a string (all occurences).
  40. */
  41. std::string replaceChar(const std::string& s, char oldChar, char newChar);
  42. } // namespace
  43. #endif // STRINGUTILS_H