• 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: case-insensitive but case-ordered sort
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: case-insensitive but case-ordered sort


  • Subject: Re: case-insensitive but case-ordered sort
  • From: Keary Suska <email@hidden>
  • Date: Tue, 20 Jul 2010 14:48:12 -0600

On Jul 20, 2010, at 11:39 AM, Roland King wrote:

> I thought perhaps that comparing the two strings case insensitively, returning that compare if they are not equal, but if they are equal, comparing them case sensitively and returning the inverse of that (remember I want a to beat A) would do what I want but I've failed to convince myself that actually works.

This approach will not provide overall lower-before-capital sorting, so I expect it won't work. Consider the following:

aClass
AAClass

Will sort, using the method you describe, to

AAClass
aClass

Because A comes before C and they are unequal (so a is never compared to A). Using a custom selector/function is probably the only way to go, and I can't think of any built-in method that will give the collation results you are looking for. I don't think you can escape a character-by-character comparison.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: case-insensitive but case-ordered sort
      • From: Deborah Goldsmith <email@hidden>
References: 
 >case-insensitive but case-ordered sort (From: Roland King <email@hidden>)

  • Prev by Date: Re: Can't get "pmset" to work
  • Next by Date: Re: Core Data caching very large property values in 10.6
  • Previous by thread: Re: case-insensitive but case-ordered sort
  • Next by thread: Re: case-insensitive but case-ordered sort
  • Index(es):
    • Date
    • Thread