您将如何从下面的长字符串中提取“19”?这就是我的做法,但我想知道,有没有比这更好/更快的方法?
NSString *myString = @"13.5 Points-(19) 38 Points-(50) 50 Points-(215) 4.3 Points-105.8 Points-21";
NSArray *myArray = [myString componentsSeparatedByString:@"-"];
NSString *splitString = [myArray objectAtIndex:1 ];
NSRange range = [splitString rangeOfString:@")" ];
NSString *newString = [splitString substringToIndex:range.location];
NSString *newString2 = [newString stringByReplacingOccurrencesOfString:@"(" withString:@""];
NSLog(@"newString2: %@", newString2);