• 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: Need to force Lex-Order?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need to force Lex-Order?


  • Subject: Re: Need to force Lex-Order?
  • From: Sherm Pendley <email@hidden>
  • Date: Thu, 31 Jul 2003 22:55:51 -0400

On Thursday, July 31, 2003, at 10:39 PM, Michael Hanna wrote:

Hello, I've written a Dictionary in plist format, in which I need to access the NSArrays in lex-order. However when I get allKeys:

You cannot depend on dictionary keys being stored or returned in any particular order.

Assuming that your dictionary keys are strings, as they appear to be, you can easily get a sorted list of keys with:

keyArray = [[theDict allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];

If your keys are other object types, you'll need to use some other sortedArray... variant, but the principle will be the same.

sherm--
_______________________________________________
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.

References: 
 >Need to force Lex-Order? (From: Michael Hanna <email@hidden>)

  • Prev by Date: Need to force Lex-Order?
  • Next by Date: Making my application scriptable
  • Previous by thread: Need to force Lex-Order?
  • Next by thread: Making my application scriptable
  • Index(es):
    • Date
    • Thread