Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我能够从包含以 . 开头和结尾的字符串的数组中找到所有值A。
A
我可以使用和-hasPrefix上课。-hasSuffixNSString
-hasPrefix
-hasSuffix
NSString
但我没有找到任何方法来找到相同的使用NSPredicate类。
NSPredicate
请帮帮我。提前致谢。
试试这个可能对你有帮助
NSPredicate *p = [NSPredicate predicateWithFormat:@"SELF like [c]'A*A'"]; NSArray *a = [NSArray arrayWithObjects:@" AhfjA ", @"test1", @"Test", @"AntA", nil]; NSArray *b = [a filteredArrayUsingPredicate:p]; NSLog(@"%@",b);