00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "myTools.h"
00022
00023 #include <sstream>
00024
00025 int splitLine(std::vector<std::string>& pieces, std::string toSplit, std::string delimiter, bool ignDoubleDelim)
00026 {
00027 pieces.clear();
00028 long pos=0;
00029
00030 std::string helpString = toSplit;
00031
00032 while ((pos = (long) toSplit.find(delimiter)) != -1 )
00033 {
00034 toSplit.erase (pos, toSplit.length());
00035 helpString.erase (0, pos + 1);
00036 if ( !ignDoubleDelim && (toSplit.length() != 0) )
00037 pieces.push_back(toSplit);
00038 toSplit = helpString;
00039 }
00040 pieces.push_back(toSplit);
00041 return 0;
00042 }
00043
00044 int string2int(std::string stringValue)
00045 {
00046 std::stringstream ssStream(stringValue);
00047 int iReturn;
00048 ssStream >> iReturn;
00049
00050 return iReturn;
00051 }
00052
00053 std::string int2string(int iValue)
00054 {
00055 std::stringstream ssStream;
00056 ssStream << iValue;
00057 return ssStream.str();
00058 }
00059
00060 std::string upcase(std::string val)
00061 {
00062 for (unsigned int i = 0; i < val.length(); i++)
00063 val[i] = toupper(val[i]);
00064 return val;
00065
00066 }