Go to the documentation of this file.00001 #include "GrabberUtils.h"
00002
00003 #include <sstream>
00004 #include <ctype.h>
00005 #include <algorithm>
00006
00007
00008 using namespace std;
00009
00010
00011 string toString(long _value)
00012 {
00013 ostringstream o;
00014 o<< _value;
00015 return (o.str());
00016 }
00017
00018
00019
00020 template<class T1, class T2> T1 find_first_not_of ( T1 first1, T1 last1, T2 first2, T2 last2 )
00021 {
00022 T2 mid2;
00023 for ( ; first1 != last1; first1++ )
00024 {
00025 for ( mid2 = first2; mid2 != last2; ++mid2 )
00026 if ( *first1 == *mid2 ) break;
00027 if ( mid2 == last2 ) return ( first1 );
00028 }
00029 return ( first1 );
00030 }
00031
00032 vector<string> splitString(const string &_orginal, const string &_seperators)
00033 {
00034 vector<string> elements;
00035 string::const_iterator endIt, beginIt = _orginal.begin();
00036
00037 do
00038 {
00039 endIt = find_first_of(beginIt, _orginal.end(), _seperators.begin(), _seperators.end());
00040 if (beginIt != endIt)
00041 {
00042 elements.push_back("");
00043 copy(beginIt, endIt, back_inserter(elements.back()));
00044 }
00045 beginIt = find_first_not_of(endIt, _orginal.end(), _seperators.begin(), _seperators.end());
00046
00047 } while (beginIt != _orginal.end());
00048
00049 return elements;
00050 }