Jestem dość zielony w regex z Objective-C. Mam z tym trudności.Objective-C NSRegularExpressions, znajdowanie pierwszego wystąpienia liczb w ciągu
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"\\b([1-9]+)\\b" options:NSRegularExpressionCaseInsensitive error:®Error];
if (regError) {
NSLog(@"%@",regError.localizedDescription);
}
__block NSString *foundModel = nil;
[regex enumerateMatchesInString:self.model options:kNilOptions range:NSMakeRange(0, [self.model length]) usingBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop) {
foundModel = [self.model substringWithRange:[match rangeAtIndex:0]];
*stop = YES;
}];
Wszystko szukam zrobić, to wziąć ciąg jak
150A
I dostać
150
Tak doskonały. Dziękuję Ci! – rnystrom