• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Localized decimal point?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Localized decimal point? (From: Mark Dawson <email@hidden>)

  • Prev by Date: [[NSNotificationCenter defaultCenter] postNotificationName:...] in a C function get error
  • Next by Date: Re: creating a command without a menu item
  • Previous by thread: Localized decimal point?
  • Next by thread: Re: Localized decimal point?
  • Index(es):
    • Date
    • Thread