std::vector< std::string > tokens;
boost::split( tokens, URL, boost::is_any_of( ":/" ));
It is very simple and straightforward way to implement the functions.
much better than istringstream.getline used before.
char tmp[128];
istringstream stream(str.c_str());
stream.getline(tmp, MAX_ATTRIBUTE_LEN, delimiter);
Also check the boost website
http://www.boost.org/doc/libs/1_49_0/doc/html/string_algo/usage.html
such like case conversion and trim are there.
string str1("HeLlO WoRld!");
to_upper(str1); // str1=="HELLO WORLD!"
string str1=" hello world! ";
string str2=trim_left_copy(str1); // str2 == "hello world! "
string str3=trim_right_copy(str1); // str3 == " hello world!"
trim(str1); // str1 == "hello world!"
It is cool. Don't know the performance now but let it there
unless it is the bottleneck of the whole application. I believe it won't be recently.
No comments:
Post a Comment