diff options
-rw-r--r-- | Interfaces/English.lproj/Credits.rtf | 2 | ||||
-rw-r--r-- | Source/CMTextView.m | 1 | ||||
-rw-r--r-- | Source/SPStringAdditions.h | 4 | ||||
-rw-r--r-- | Source/SPStringAdditions.m | 33 |
4 files changed, 39 insertions, 1 deletions
diff --git a/Interfaces/English.lproj/Credits.rtf b/Interfaces/English.lproj/Credits.rtf index c2e6cc21..4ca6fc5d 100644 --- a/Interfaces/English.lproj/Credits.rtf +++ b/Interfaces/English.lproj/Credits.rtf @@ -1,7 +1,6 @@ {\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf430 {\fonttbl\f0\fnil\fcharset0 LucidaGrande;} {\colortbl;\red255\green255\blue255;\red25\green25\blue25;} -\vieww13440\viewh12000\viewkind0 \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\qc\pardirnatural \f0\b\fs22 \cf2 Current Developers @@ -34,6 +33,7 @@ Stuart B. Glenn\ Jason Hallford\ Carsten Bl\'fcm\ Andrea Salomoni\ +Greg Hulands\ \ \b Artwork diff --git a/Source/CMTextView.m b/Source/CMTextView.m index 369e9a43..bce2bd4a 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -22,6 +22,7 @@ // Or mail to <lorenz@textor.ch> #import "CMTextView.h" +#import "SPStringAdditions.h" @implementation CMTextView diff --git a/Source/SPStringAdditions.h b/Source/SPStringAdditions.h index d2ac5d4b..4acd748c 100644 --- a/Source/SPStringAdditions.h +++ b/Source/SPStringAdditions.h @@ -26,4 +26,8 @@ + (NSString *)stringForByteSize:(int)byteSize; +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 + - (NSArray *)componentsSeparatedByCharactersInSet:(NSCharacterSet *)set; +#endif + @end diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m index a51df693..2916611d 100644 --- a/Source/SPStringAdditions.m +++ b/Source/SPStringAdditions.m @@ -66,4 +66,37 @@ return [numberFormatter stringFromNumber:[NSNumber numberWithFloat:size]]; } +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 + // ------------------------------------------------------------------------------- + // componentsSeparatedByCharactersInSet: + // Credit - Greg Hulands <ghulands@mac.com> + // Needed for 10.4+ compatibility + // ------------------------------------------------------------------------------- + - (NSArray *)componentsSeparatedByCharactersInSet:(NSCharacterSet *)set // 10.5 adds this to NSString, but we are 10.4+ + { + NSMutableArray *result = [NSMutableArray array]; + NSScanner *scanner = [NSScanner scannerWithString:self]; + NSString *chunk = nil; + + [scanner setCharactersToBeSkipped:nil]; + BOOL sepFound = [scanner scanCharactersFromSet:set intoString:(NSString **)nil]; // skip any preceding separators + + if (sepFound) { // if initial separator, start with empty component + [result addObject:@""]; + } + + while ([scanner scanUpToCharactersFromSet:set intoString:&chunk]) { + [result addObject:chunk]; + sepFound = [scanner scanCharactersFromSet: set intoString: (NSString **) nil]; + } + + if (sepFound) { // if final separator, end with empty component + [result addObject: @""]; + } + + result = [result copy]; + return [result autorelease]; + } +#endif + @end |