From 88f12bad9348e27c60e318aef368d678c073bd7e Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Mon, 10 Nov 2008 10:29:46 -0800 Subject: [PATCH] implement NSString compare:options:range Thanks to Cacaodev for the ticket and initial stab at this. [#105 state:resolved milestone:0.6] --- Foundation/CPString.j | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Foundation/CPString.j b/Foundation/CPString.j index b9b0dcbe9..f72f6af15 100644 --- a/Foundation/CPString.j +++ b/Foundation/CPString.j @@ -452,6 +452,21 @@ var CPStringHashes = new objj_dictionary(); return CPOrderedSame; } +/*! + Compares the receiver to the specified string, using options in range. + @param aString the string with which to compare the range of the receiver specified by range. + @param aMask the options to use for the comparison + @param range the range of the receiver over which to perform the comparison. The range must not exceed the bounds of the receiver. + @return the result of the comparison +*/ +- (CPComparisonResult)compare:(CPString)aString options:(int)aMask range:(CPRange)range +{ + var lhs = [self substringWithRange:range], + rhs = aString; + + return [lhs compare:rhs options:aMask]; +} + /*! Returns YES if the receiver starts with the specified string. If aString