Created
August 29, 2012 06:45
-
-
Save Me1000/3507567 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 *localDateString = [NSDateFormatter dateFormatFromTemplate:@"MdY" options:0 locale:[NSLocale currentLocale]]; | |
NSCharacterSet *validChars = [NSCharacterSet letterCharacterSet]; | |
NSInteger i = 0; | |
NSMutableString *newString = [NSMutableString stringWithCapacity:5]; | |
while (i < [localDateString length]) | |
{ | |
char charatcter = [localDateString characterAtIndex:i]; | |
static NSString *appendChar = @"%c"; | |
if ([validChars characterIsMember:charatcter]) | |
[newString appendFormat:appendChar, charatcter]; | |
i++; | |
} | |
static NSString *dateSeperator = @"."; | |
[newString insertString:dateSeperator atIndex:1]; | |
[newString insertString:dateSeperator atIndex:3]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment