Re: Localized decimal point?
Re: Localized decimal point?
- Subject: Re: Localized decimal point?
- From: "R. Scott Thompson" <email@hidden>
- Date: Mon, 6 Dec 2004 16:32:59 -0600
On Dec 6, 2004, at 4:20 PM, Mark Dawson wrote:
I'm new to Cocoa, and haven't seen this quite asked:
I want to write a subclass of NSFormatter. One piece would validate the input (in isPartialStringValid). I want to allow decimal points--however, I also want this to be correct localizing-wise.
I've seen code to create a set of valid characters:
NSCharacterSet *disallowedCharacters = [[NSCharacterSet
characterSetWithCharactersInString:@"0123456789.'"] invertedSet];
However, the decimal point is a comma in Europe (i.e. 1/2 = 0.5 US 0,5 France?). I don't know if there are any other decimal point variations. So, in the US, I want to allow ',', while NOT allowing a ','; in a France allow/not allow the opposite.
How would I figure out what the current decimal point character is?
Thanks!
You might look at CFNumberFormatter and in particular CFNumberFormatterGetValueFromString.
Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden