• 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: NSDecimalSeparator localization II
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDecimalSeparator localization II


  • Subject: Re: NSDecimalSeparator localization II
  • From: "Sean McBride" <email@hidden>
  • Date: Thu, 30 Dec 2004 18:24:09 -0500

mark (email@hidden) on Thu, Dec 30, 2004 05:07 PM said:

>Well, that shows up a BIG hole in my localization knowledge.  I had thought
>that the '0' decimal-type character set was universal.  Oh well.

It is nearly universal.

>So if I understand correctly (it works in my testing, but I wanted to make
>sure), I should change things to:
>
>if ([[NSCharacterSet decimalDigitCharacterSet] characterIsMember: '0'])
>// if not '0' based, don't trim
>    {
>        aString = [*fromString
>stringByTrimmingCharactersInSet:[NSCharacterSet
>characterSetWithCharactersInString:@"0"]];  // strip trailing zero's

This will strip all '0's, not just those that the end.

>// Note: can't strip both 0's and decimal point at the same time because it
>// will overstrip--turing 10000.00 into 1, while we want it 10000
>aString = [aString stringByTrimmingCharactersInSet:[NSCharacterSet
>characterSetWithCharactersInString:(NSString *)[[NSUserDefaults
>standardUserDefaults] objectForKey:NSDecimalSeparator]]];

I think the chance of anyone using a number char as the decimal separator
is almost 0.  If it were me, I'd just check at the beginning of the
function and if this strange event is true, then I'd just leave the
string alone, after all, the string basically makes no sense!


--
____________________________________________________________
Sean McBride, B. Eng                         email@hidden
Mac Software Designer               Montréal, Québec, Canada


 _______________________________________________
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

  • Follow-Ups:
    • Re: NSDecimalSeparator localization II
      • From: Andrew Farmer <email@hidden>
    • Re: NSDecimalSeparator localization II
      • From: John Stiles <email@hidden>
References: 
 >Re: NSDecimalSeparator localization II (From: mark <email@hidden>)

  • Prev by Date: Re: Compiler not finding "NSDebug.h" - WHY?
  • Next by Date: Re: NSDecimalSeparator localization II
  • Previous by thread: Re: NSDecimalSeparator localization II
  • Next by thread: Re: NSDecimalSeparator localization II
  • Index(es):
    • Date
    • Thread