• 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: NSString doubleValue and zero
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString doubleValue and zero


  • Subject: Re: NSString doubleValue and zero
  • From: Jonathan Jackel <email@hidden>
  • Date: Wed, 19 Feb 2003 22:52:15 -0500

> I use the message doubleValue to get a number value out of a string. If
> the string is not a number then i need to store the string. My problem
> is that if the string is not a number then doubleValue return 0.
>
> But then how am i supposed to know when it is an actual number with
> value 0 or a string that was not a number.

I just stumbled on this. It seems to work.

if ([[NSDecimalNumber decimalNumberWithString:yourString]
isEqualTo:[NSDecimalNumber notANumber]])
{
//it's not a number
} else {
//it is a number
}

Jonathan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Possible to use Cocoa views in a Carbon window?
  • Next by Date: Re: nsformatters and focus
  • Previous by thread: Re: NSString doubleValue and zero
  • Next by thread: Re: NSString doubleValue and zero
  • Index(es):
    • Date
    • Thread