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
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to