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
00029 #ifndef MYSQLPP_STRING_UTIL_H
00030 #define MYSQLPP_STRING_UTIL_H
00031
00032 #include "defs.h"
00033
00034 #include <ctype.h>
00035
00036 #include <string>
00037
00038 namespace mysqlpp {
00039
00041 extern void strip(std::string& s);
00042
00044 extern void escape_string(std::string& s);
00045
00047 inline void str_to_upr(std::string& s)
00048 {
00049 for (unsigned int cnt=0; cnt < s.length(); cnt++) {
00050 char c = s[cnt]; s[cnt]=toupper(c);
00051 }
00052 }
00053
00055 inline void str_to_lwr (std::string& s)
00056 {
00057 for (unsigned int cnt=0; cnt < s.length(); cnt++) {
00058 char c = s[cnt]; s[cnt]=tolower(c);
00059 }
00060 }
00061
00063 inline void strip_all_blanks (std::string& s)
00064 {
00065 for (unsigned int counter=0;counter < s.size();counter++)
00066 if (s[counter] == ' ') { s.erase(counter,1); counter--;}
00067 }
00068
00070 inline void strip_all_non_num (std::string& s)
00071 {
00072 for (unsigned int counter=0;counter < s.size();counter++)
00073 if (!isdigit(s[counter])) { s.erase(counter,1); counter--;}
00074 }
00075
00076 }
00077
00078 #endif
00079