[Top][All Lists]

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

Re: locale dependent printf

From: Nicola Pero
Subject: Re: locale dependent printf
Date: Fri, 27 Apr 2001 15:20:24 +0100 (BST)

> Then I think I have found another bug, because I don't have any possibility
> to get a float number locale independent. I tried with [NSString
> stringWithFormat: "%f", floatValue] and with [[NSNumber numberWithFloat:
> floatValue] stringValue].
> Even saving this NSNumber instance into a dictionary and writing it to a
> file failed. I always get 9,5 instead of 9.5.

NSString *result;
float floatValue = 9.5;

/* Switch to default locale */
GSSetLocale ("C");

result = [NSString stringWithFormat: "%f", floatValue];

/* Switch back to user defined locale */
GSSetLocale ("");

reply via email to

[Prev in Thread] Current Thread [Next in Thread]