gpt4 book ai didi

ios - 使用谓词在数组中搜索字典

转载 作者:可可西里 更新时间:2023-11-01 17:17:39 27 4
gpt4 key购买 nike

我有一个字典数组,我想找到键“guid”具有所需值的字典。无法使用此代码获取它:

NSPredicate *filter = [NSPredicate predicateWithFormat:@"guid = %@", key];
NSArray *filteredContacts = [selectedValue filteredArrayUsingPredicate:filter];

最佳答案

试试这个。

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"Name CONTAINS[cd] %@",searchBar.text];

filterdArray = [[hospitalArray filteredArrayUsingPredicate:predicate] mutableCopy];

其中Name是数组下字典中包含的key。

关于ios - 使用谓词在数组中搜索字典,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25759757/

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