Re: strange behaviour with `find_first/last_not_of()` functions



Hi,

See http://en.cppreference.com/w/cpp/string/basic_string/find_first_not_of

4294967295 is the value of npos.

Regards,
---
François



2015-08-20 4:54 UTC+02:00, Nicolas Jäger <jagernicolas legtux org>:
hi,

I'm working on a piece of code where an entry is used to write some
tags seperated by ';'. So I'm using `split_simple(";", text)` to get a
`std::vector` loaded of each terms between ';'. At this point if the
user wrote something like :

"gtkmm ; is; awesome"

the vector record :

"gtkmm ", " is", " awesome"

to avoid duplicate tags I want to
remove all blank space at the begining and at the end of each terms.
For doing this I'm using `find_first_not_of( " " )` and
`find_last_not_of( " " )`.  with the example above, that works as
expected.

but there is one case who leads to an error. If I just type " ;" (blank
space and a semicolon), the both (finders) functions return a value of
4294967295

here the code : http://pastebin.com/zLjd2T2k

regards,
nicolas
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list



-- 
----
François


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]