Skip to content

Instantly share code, notes, and snippets.

@pratikshabhisikar
Created August 9, 2011 06:56
Show Gist options
  • Save pratikshabhisikar/1133530 to your computer and use it in GitHub Desktop.
Save pratikshabhisikar/1133530 to your computer and use it in GitHub Desktop.
NSScanner
NSString *date = nil;
NSScanner *scanner = [NSScanner scannerWithString:@"/Date(1312603200000-0400)/"];
while ([scanner isAtEnd] == NO) {
[scanner scanUpToString:@"(" intoString:NULL];
[scanner setScanLocation:[scanner scanLocation] + 1];
[scanner scanUpToString:@")" intoString:&date];
break;
}
NSLog(@"Date is: %@", date);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment