• 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: count instances in an NSArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: count instances in an NSArray


  • Subject: Re: count instances in an NSArray
  • From: Shaun Wexler <email@hidden>
  • Date: Mon, 4 Oct 2004 18:04:10 -0700

On Oct 4, 2004, at 5:13 PM, Jonathan 'Wolf' Rentzsch wrote:

I'm missing a way count the number of instances (using isEqual:) in an
NSArray. Think containsObject:, except returning an unsigned instead of a
BOOL. Sure I could easily code my own counter, but I think I'm missing a
built-in way...

If efficiency doesn't matter:

UInt32 numberOfInstances = [[NSSet setWithArray:array] count];

HTH~
--
Shaun Wexler
MacFOH
http://www.macfoh.com

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
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: 
 >count instances in an NSArray (From: "Jonathan 'Wolf' Rentzsch" <email@hidden>)

  • Prev by Date: Re: How to avoid warning with objc_msgSend
  • Next by Date: Re: count instances in an NSArray
  • Previous by thread: count instances in an NSArray
  • Next by thread: Re: count instances in an NSArray
  • Index(es):
    • Date
    • Thread