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

Re: kCFCompareNumerically


  • Subject: Re: kCFCompareNumerically
  • From: Ondra Cada <email@hidden>
  • Date: Mon, 14 Jan 2002 12:31:58 +0100

Steve,

>>>>>> Steve Gehrman (SG) wrote at Sun, 13 Jan 2002 22:11:30 -0800:
SG> "kCFCompareNumerically is currently ignored in the Compare routines."

I don't have a slightest idea how this should work, but...

SG> Does anyone have code that will compare NSStrings numerically ie:
SG> Foo2.txt < Foo7.txt < Foo25.txt

...regarding this example, I guess you are after something like

NSComparisonResult numericStringCompare(NSString *a,NSString *b) {
int plen=[[a commonPrefixWithString:b options:0] length];
return [[a substringFromIndex:plen] intValue]-[[b substringFromIndex:plen]
intValue];
}

Not tested, might contain some bugs, but is simple enough to be fixed.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
2K Development: email@hidden http://www.2kdevelopment.cz
private email@hidden http://www.ocs.cz/oc


  • Follow-Ups:
    • Re: kCFCompareNumerically
      • From: Norbert Heger <email@hidden>
    • Re: kCFCompareNumerically
      • From: Norbert Heger <email@hidden>
References: 
 >kCFCompareNumerically (From: Steve Gehrman <email@hidden>)

  • Prev by Date: Re: Get screen size
  • Next by Date: Re: Database
  • Previous by thread: Re: kCFCompareNumerically
  • Next by thread: Re: kCFCompareNumerically
  • Index(es):
    • Date
    • Thread