I have any NSarray
of NSString
objects.
I want to extract those string which only contains character or character&numeric from it.
For example: "D6,Bombay.Hello”" is valid whereas “123456.123,56” is invalid.
Please help if anyone have idea.
I have any NSarray
of NSString
objects.
I want to extract those string which only contains character or character&numeric from it.
For example: "D6,Bombay.Hello”" is valid whereas “123456.123,56” is invalid.
Please help if anyone have idea.
You can filter array using predicate to get only
NSPredicate *pred = [NSPredicate predicateWithBlock:^BOOL(id str, NSDictionary *unused) {
return ([str rangeOfCharacterFromSet:[NSCharacterSet letterCharacterSet]].location != NSNotFound);
}];
NSArray *filtered = [yourArray filteredArrayUsingPredicate:pred];