Re: decimal separator



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.

Yeti


--
That's enough.



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