Last active
August 29, 2015 13:56
-
-
Save seivan/8793649 to your computer and use it in GitHub Desktop.
Because it's 23:30 and I'm tired as fuck.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(NSString *)platformsAsOxfordComma; { | |
NSArray * platforms = (NSArray *)self.platforms; | |
return [platforms SH_reduceValue:@"".mutableCopy withBlock:^id(NSMutableString * memo, NSString * obj) { | |
if(platforms.lastObject == obj) { | |
if(platforms.count > 1) [memo appendString:NSLocalizedString(@"AND", nil)]; // Do other languages even work like this? | |
[memo appendString:obj]; | |
} | |
else { | |
[memo appendString:obj]; | |
[memo appendString:@", "]; | |
} | |
return memo; | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment