gpt4 book ai didi

ios - 使用NSPredicate过滤以非字母字符开头的条目

转载 作者:行者123 更新时间:2023-12-01 18:55:59 25 4
gpt4 key购买 nike

我有一个UITableView,我试图将其拆分为A-Z部分,然后对其他所有内容进行#处理,我尝试使用以下方法将主数组中的数据过滤到非字母部分中:

NSArray *selectionArray = [nameArray filteredArrayUsingPredicate: [NSPredicate predicateWithFormat:@"NOT (SELF beginswith[c] %@)", @"^[A-Za-z].*"]];

不幸的是,它没有按照我的想法工作,并且一切都被放入 selectionArray
任何帮助将不胜感激,谢谢。

最佳答案

似乎“beginswith”运算符不支持正则表达式。下一个谓词为我工作:“不(自已匹配[c]'^ [A-Za-z]。*')”)。

关于ios - 使用NSPredicate过滤以非字母字符开头的条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27159321/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com