• 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 13:54:13 -0500

Mark Dawson (email@hidden) on Thu, Dec 30, 2004 01:02 PM said:

>	unsigned int len = [aString length];
>	if (len <= 2)	// can't have trailing zero's with a string length of 2
>or less
>		return;

What about a string like ".0"?  A degenerate example I know. :)

>		if (!(c >= '1' && c <= '9'))

Not all languages use the characters 0 to 9.  Happily, there is
[NSCharacterSet decimalDigitCharacterSet] and NSString's
stringByTrimmingCharactersInSet, which you can use together to do this
more nicely.

You can also use the above to check if NSDecimalSeparator has any numbers
in it, then maybe just don't touch the string at all.


--
____________________________________________________________
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: mark <email@hidden>
References: 
 >Re: NSDecimalSeparator localization II (From: Mark Dawson <email@hidden>)

  • Prev by Date: Re: multiple declarations for method `length' ?
  • Next by Date: Re: multiple declarations for method `length' ?
  • Previous by thread: Re: NSDecimalSeparator localization II
  • Next by thread: Re: NSDecimalSeparator localization II
  • Index(es):
    • Date
    • Thread