Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Need to force Lex-Order?



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.

References: 
 >Open source version of cocoa (From: Mike Zornek <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.