2008-02-16 13:05:30 +00:00
|
|
|
//
|
|
|
|
// 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
|
2022-02-07 05:49:27 +00:00
|
|
|
- (NSComparisonResult)compareTrackNumbers:(NSString *)aString {
|
|
|
|
return [self compare:aString options:NSNumericSearch];
|
2008-02-16 13:05:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
2009-02-28 17:41:37 +00:00
|
|
|
|
|
|
|
@implementation NSURL (CogSort)
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (NSComparisonResult)compareTrackNumbers:(NSURL *)aURL {
|
2009-02-28 17:41:37 +00:00
|
|
|
return [[self absoluteString] compareTrackNumbers:[aURL absoluteString]];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|