1
0

StringTokenizer.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. ***********************************************************************
  3. * Class: StringTokenizer *
  4. * By Arash Partow - 2000 *
  5. * URL: http://www.partow.net/programming/stringtokenizer/index.html *
  6. * *
  7. * Copyright Notice: *
  8. * Free use of this library is permitted under the guidelines and *
  9. * in accordance with the most current version of the Common Public *
  10. * License. *
  11. * http://www.opensource.org/licenses/cpl.php *
  12. * *
  13. ***********************************************************************
  14. */
  15. #ifndef INCLUDE_STRINGTOKENIZER_H
  16. #define INCLUDE_STRINGTOKENIZER_H
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include <iostream>
  20. #include <string>
  21. namespace csr {
  22. class StringTokenizer {
  23. public:
  24. StringTokenizer(const std::string& _str, const std::string& _delim);
  25. ~StringTokenizer(){};
  26. int countTokens();
  27. bool hasMoreTokens();
  28. std::string nextToken();
  29. int nextIntToken();
  30. double nextFloatToken();
  31. std::string nextToken(const std::string& delim);
  32. std::string remainingString();
  33. std::string filterNextToken(const std::string& filterStr);
  34. private:
  35. std::string token_str;
  36. std::string delim;
  37. };
  38. } // namespace csr {
  39. #endif