如何在字符串中取到数字

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);

你可能感兴趣的:(如何在字符串中取到数字)