Re: [gtkmm] Glib::ustring -> int
- From: MHL Schulze t-online de (Martin Schulze)
- To: Daniel Evison <devison pacificit co nz>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: [gtkmm] Glib::ustring -> int
- Date: Wed, 4 Sep 2002 14:11:54 +0200
Am 04.09.2002 12:22 schrieb(en) Daniel Evison:
An easier way is to use the very flexible "lexical_cast" function from
the
C++ Boost library. See
http://www.boost.org/libs/conversion/lexical_cast.htm
It uses a string stream and also handles errors (by throwing an
exception).
The syntax would then be:
Glib::ustring s("123456");
long x = boost::lexical_cast<long>(s);
Do you know whether this is also guaranteed to work with user input?
Or are there be other unicode characters apart from 0123456789 for
other languages (like Chinese) that make up numeric values and
wouldn't be converted correctly?
If yes, do you think
long x = boost::lexical_cast<long>(Glib::locale_from_utf8(s))
should work for every case?
Regards,
Martin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]