Cog/Utils/NSString+CogSort.m
Christopher Snowhill 85c7073649 Reformat my own source code with clang-format
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-06 21:49:27 -08:00

27 lines
640 B
Objective-C

//
// 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
@implementation NSURL (CogSort)
- (NSComparisonResult)compareTrackNumbers:(NSURL *)aURL {
return [[self absoluteString] compareTrackNumbers:[aURL absoluteString]];
}
@end