如何在字符串中取到数字
2016-03-15 本文已影响21人
单腿行走的大象
NSString *string = @"sadasd1+22][13ds98";
NSRegularExpression *regular = [NSRegularExpression regularExpressionWithPattern:@"[a-zA-Z.-]" options:0 error:NULL];
NSString *result = [regular stringByReplacingMatchesInString:string options:0 range:NSMakeRange(0, [string length]) withTemplate:@""];
NSLog(@"%@", result);