00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef STRINGTOOLS_H
00029 #define STRINGTOOLS_H
00030
00031 #include <string>
00032 #include <vector>
00033 #include <sstream>
00034
00035 using namespace std;
00036
00038
00039 namespace StringTools
00040 {
00041
00043 enum KeywordCase
00044 {
00045 CASE_UNCHANGED,
00046 CASE_LOWER,
00047 CASE_UPPER,
00048 CASE_CAPITALIZE
00049 };
00050
00056 string change_case ( const string & s,
00057 const KeywordCase kcase = CASE_LOWER ) throw();
00058
00063 string trimRight ( const string &value );
00064
00068 string getParantheseVal ( const string &s );
00069
00074 vector <string> splitString ( const string& s, unsigned char delim );
00075
00081 template <class T>
00082 bool str2num ( T &val, const std::string& s, std::ios_base& ( *f ) ( std::ios_base& ) )
00083 {
00084 std::istringstream iss ( s );
00085 return ! ( iss >> f >> val ).fail();
00086 }
00087
00088 }
00089
00090 #endif