00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "super_string/super_string.hpp"
00016 #include "boost/date_time/gregorian/gregorian.hpp"
00017 #include <iostream>
00018
00019 using std::string;
00020 using std::cout;
00021 using std::wcout;
00022 using std::endl;
00023 using namespace boost::gregorian;
00024
00025
00026 int
00027 main()
00028 {
00029
00030 super_string s(" (456789) [123] 2006-10-01 abcdef ");
00031 s.to_upper();
00032 cout << s << endl;
00033
00034 s.trim();
00035 cout << s << endl;
00036
00037 double dbl = 1.23456;
00038 s.append(dbl);
00039 s+= " ";
00040 cout << s << endl;
00041
00042 date d(2006, Jul, 1);
00043 s.insert_at(28, d);
00044 cout << s << endl;
00045
00046
00047 if (s.contains_regex("\\d{4}-\\d{2}-\\d{2}")) {
00048
00049 s.replace_all_regex("\\(([0-9]+)\\)", "__[$1]__");
00050 cout << s << endl;
00051
00052
00053
00054 super_string::string_vector out_vec;
00055 unsigned int count = s.split_regex("\\s+", out_vec);
00056 if (count) {
00057 for(int i=0; i < out_vec.size(); ++i) {
00058 out_vec[i].replace_first("__","");
00059 cout << i << " " << out_vec[i] << endl;
00060 }
00061 }
00062 }
00063
00064
00065 wsuper_string ws(L" hello world ");
00066 ws.trim_left();
00067 wcout << ws << endl;
00068
00069 return 0;
00070
00071 }