• 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
Sorting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sorting


  • Subject: Sorting
  • From: "Peter Karlsson" <email@hidden>
  • Date: Wed, 16 Feb 2005 10:34:33 +0100

Dear list!

I have a .plist file looking like this:

<array>
	<dict>
		<key>name</key>
		<string>NINA  </string>
		<key>idnumber</key>
		<string>1</string>
		<key>keyword</key>
		<string>Bass, String, Bell</string>
	</dict>
	<dict>
		<key>name</key>
		<string>HRPORG</string>
		<key>idnumber</key>
		<string>2</string>
		<key>keyword</key>
		<string>Organ, Synth</string>
	</dict>
	<dict>
		<key>name</key>
		<string>PLKATK</string>
		<key>idnumber</key>
		<string>3</string>
		<key>keyword</key>
		<string>Whistle</string>
	</dict>
</array>

I want to sort it in alphabetical order, and sort it by key 'name'. How do
I do that?

I'm using this code to sort arrays:

[myMutableArray sortUsingSelector:@selector(compareNumerically:)];

- (NSComparisonResult)compareNumerically:(NSString *)string
	{
		return [self compare:string options:(NSNumericSearch |
NSCaseInsensitiveSearch)];
	}

And it works very good. Can it be modified to do the same thing with the
contents of my .plist file?

Best regards Peter

 _______________________________________________
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

  • Prev by Date: Re: Saving NSObjectController info
  • Next by Date: NSUserdefaults shared by 2 applications, not synchronized ?
  • Previous by thread: Re: Re: Binding one array controller to the variable of the content of
  • Next by thread: Re: Sorting
  • Index(es):
    • Date
    • Thread