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

Need to force Lex-Order?


  • Subject: Need to force Lex-Order?
  • From: Michael Hanna <email@hidden>
  • Date: Thu, 31 Jul 2003 22:39:19 -0400

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:

////////
//CODE//


- (void)awakeFromNib
{
NSString *path; // the path to the bundled property list
NSArray *keyArray; // the list of keys in the NSDictionary, useful for debugging


path = [[NSBundle mainBundle] pathForResource:@"phrases" ofType:@"plist"];

theDict = [NSDictionary dictionaryWithContentsOfFile: path];

keyArray = [theDict allKeys];

NSLog(@"Key Array: %@", keyArray);

}


//CODE//
////////

//////////
//OUTPUT//

2003-07-31 22:21:09.014 Country Song[6666] Key Array: <CFArray 0x1ba530 [0xa01303fc]>{type = immutable, count = 13, values = (
0 : <CFString 0x1ba640 [0xa01303fc]>{contents = "lines"}
1 : <CFString 0x1cf320 [0xa01303fc]>{contents = "phrase_01"}
2 : <CFString 0x1cca70 [0xa01303fc]>{contents = "phrase_11"}
3 : <CFString 0x1cf290 [0xa01303fc]>{contents = "phrase_12"}
4 : <CFString 0x1cc5f0 [0xa01303fc]>{contents = "phrase_10"}
5 : <CFString 0x1cf520 [0xa01303fc]>{contents = "phrase_02"}
6 : <CFString 0x1cf720 [0xa01303fc]>{contents = "phrase_03"}
7 : <CFString 0x1cf930 [0xa01303fc]>{contents = "phrase_04"}
8 : <CFString 0x1cfbc0 [0xa01303fc]>{contents = "phrase_05"}
9 : <CFString 0x1cfdc0 [0xa01303fc]>{contents = "phrase_06"}
10 : <CFString 0x1cfe30 [0xa01303fc]>{contents = "phrase_07"}
11 : <CFString 0x1d02e0 [0xa01303fc]>{contents = "phrase_08"}
12 : <CFString 0x1d0500 [0xa01303fc]>{contents = "phrase_09"}
)}

//OUTPUT//
//////////

it results in a keyArray in non-lex order. Are the arrays actually in lex-order? Lex-order is something that I need to depend on.

Michael
_______________________________________________
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:
    • Making my application scriptable
      • From: Ben Mackin <email@hidden>
    • Re: Need to force Lex-Order?
      • From: Sherm Pendley <email@hidden>
References: 
 >Open source version of cocoa (From: Mike Zornek <email@hidden>)

  • Prev by Date: Open source version of cocoa
  • Next by Date: Re: Need to force Lex-Order?
  • Previous by thread: Open source version of cocoa
  • Next by thread: Re: Need to force Lex-Order?
  • Index(es):
    • Date
    • Thread