Glib::ustring.substr() problem
- From: Philipp Klaus Krause <pkk spth de>
- To: gtkmm-list <gtkmm-list gnome org>
- Subject: Glib::ustring.substr() problem
- Date: Fri, 05 Oct 2007 16:18:33 +0200
I'm trying to use find_first_of(), find_first_not_of() and substr() to
parse an input line. However, substr() gives me strings which are too long:
Glib::ustring l2, l = "\ta1, b1,c1";
std::cout << l << "\n";
Glib::ustring::size_type p, p2;
p = l.find_first_not_of(" \t,");
p2 = l.find_first_of(" \t,", p);
l2 = l.substr(p,p2);
std::cout << l2 << "\n";
p = l.find_first_not_of(" \t,", p2);
p2 = l.find_first_of(" \t,", p);
l2 = l.substr(p,p2);
std::cout << l2 << "\n";
p = l.find_first_not_of(" \t,", p2);
p2 = l.find_first_of(" \t,", p);
l2 = l.substr(p,p2);
std::cout << l2 << "\n";
Give the following output:
a1, b1,c1
a1,
b1,c1
c1
Why is c1 there?
Philipp
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]