Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

stringtokenizer.h

Go to the documentation of this file.
00001 #ifndef __STRINGTOKENIZER_H
00002 #define __STRINGTOKENIZER_H
00003 
00004 #include <vector>
00005 using namespace std;
00006 
00007 class StringTokenizer : public vector<string>
00008 {
00009         public:
00010                 StringTokenizer(const string &rStr, const string &rDelimiters = " ,\n")
00011                 {
00012                         string::size_type lastPos(rStr.find_first_not_of(rDelimiters, 0));
00013                         string::size_type pos(rStr.find_first_of(rDelimiters, lastPos));
00014                         while (string::npos != pos || string::npos != lastPos)
00015                         {
00016                                 push_back(rStr.substr(lastPos, pos - lastPos));
00017                                 lastPos = rStr.find_first_not_of(rDelimiters, pos);
00018                                 pos = rStr.find_first_of(rDelimiters, lastPos);
00019                         }
00020                 }
00021 };
00022 
00023 #endif

Generated on Sat Nov 5 16:17:24 2005 for OPIE by  doxygen 1.4.2