• 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: Compare NSNumber with an int
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compare NSNumber with an int


  • Subject: Re: Compare NSNumber with an int
  • From: "M. Uli Kusterer" <email@hidden>
  • Date: Mon, 15 Dec 2003 14:41:12 +0100

At 12:09 Uhr +0100 15.12.2003, Sscar Morales Vivs wrote:
I'm getting it from heart, but it should be:

if([Number intValue] == 10)

or

if([Number isEqualToNumber:[NSNumber numberWithInt:10]])

The first solution is preferable as it doesn't create a spurious object.

The second, however, will also work if your NSNumber in Number doesn't contain an integer.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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.
  • Follow-Ups:
    • Re: Compare NSNumber with an int
      • From: Just van Rossum <email@hidden>
References: 
 >Compare NSNumber with an int (From: Roberto <email@hidden>)
 >Re: Compare NSNumber with an int (From: Óscar Morales Vivó <email@hidden>)

  • Prev by Date: Re: Object Instantiation Q.
  • Next by Date: Re: Compare NSNumber with an int
  • Previous by thread: Re: Compare NSNumber with an int
  • Next by thread: Re: Compare NSNumber with an int
  • Index(es):
    • Date
    • Thread