• 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: Kyle Sluder <email@hidden>
  • Date: Tue, 20 Jul 2010 12:46:18 -0700

On Tue, Jul 20, 2010 at 11:04 AM, Charlie Dickman <email@hidden> wrote:
> You should be able to accomplish what you want using NSPredicate.

NSPredicate will just wind up falling through to the same sorting
methods Roland can call directly.

> You can also use the C functions topper and tolower to detect and distinguish case differences.

Don't do this.

1. These functions are ASCII only. (Although the man page mentions
they extend the standard and support multibyte characters, but that
support could go away.)
2. C wide-character support is not as correct as CFString's. Since you
already have an NSString, it's trivial to use the
CFStringUppercase/CFStringLowercase/CFStringCapitalize API to
correctly change case depending on language:
http://lists.apple.com/archives/cocoa-dev/2009/May/msg00234.html
3. Why convert case when you can compare case- (and
diacritic-)insensitive directly using the CFStringCompareWithOptions
API?

In short, Core Foundation is more correct than your code, unless you
are or plan on hiring a linguistic scholar.

--Kyle Sluder
_______________________________________________

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

References: 
 >case-insensitive but case-ordered sort (From: Roland King <email@hidden>)
 >Re: case-insensitive but case-ordered sort (From: Charlie Dickman <email@hidden>)

  • Prev by Date: Can't get "pmset" to work
  • Next by Date: Re: WebView pagination for printing
  • Previous by thread: Re: case-insensitive but case-ordered sort
  • Next by thread: Re: case-insensitive but case-ordered sort
  • Index(es):
    • Date
    • Thread