cog/Utils/NSString+CogSort.m

31 lines
644 B
Matlab
Raw Normal View History

//
// NSString+CogSort.m
// Cog
//
// Created by Matthew Grinshpun on 16/02/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import "NSString+CogSort.h"
@implementation NSString (CogSort)
// This allows us to compare track numbers separated by slashes, ie "01/17" properly
// when sorting incoming search results
- (NSComparisonResult)compareTrackNumbers:(NSString *)aString
{
return [self compare:aString options:NSNumericSearch];
}
@end
2009-02-28 17:41:37 +00:00
@implementation NSURL (CogSort)
- (NSComparisonResult)compareTrackNumbers:(NSURL *)aURL
{
return [[self absoluteString] compareTrackNumbers:[aURL absoluteString]];
}
@end