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