Re: decimal separator
- From: Quentin <squentin free fr>
- To: "David Necas (Yeti)" <yeti physics muni cz>
- Cc: gtk-list gnome org
- Subject: Re: decimal separator
- Date: Tue, 24 Jan 2006 23:44:34 +0100
On Tue, 2006-01-24 at 21:28 +0100, David Necas (Yeti) wrote:
> On Tue, Jan 24, 2006 at 09:21:48PM +0100, Quentin wrote:
> >
> > Here is how I deal with this problem in my program :
> >
> > use POSIX qw/locale_h/;
> >
> > # code that don't care what the decimal separator is
> > setlocale(LC_NUMERIC, 'C');
> > # code that needs the decimal separator to be '.'
> > setlocale(LC_NUMERIC, '');
> > # code that don't care what the decimal separator is
> >
> > Let me know if there is a better way.
>
> Definitely. See g_ascii_strtod(), g_ascii_dtostr(), and
> related functions.
>
> Moreover GUI should normally follow locale settings, that's
> quite different from `code that doesn't care what the
> decimal separator is'. Number format fixed to C is usual
> in data files, however.
Sorry, I wrongly thought this was in the gtk-perl list.
When I said "doesn't care what the decimal separator is", I meant let
perl handle it how it wants according to the local setting.
I put code between setlocal when handling data files and such.
Next time I'll check twice which list I am replying to. :)
Quentin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]