gpt4 book ai didi

ios - NSPredicate面临的问题

转载 作者:行者123 更新时间:2023-12-01 19:10:15 26 4
gpt4 key购买 nike

在下面的词典中,我有一个字典列表,我试图根据谓词获得相同的值,但我没有得到该值。

    NSPredicate* searchPredicate = [NSPredicate predicateWithFormat:@"(%K CONTAINS[c] %@)",@"**equipArray.equipmentName**",textField.text];

NSLog(@"searchPredicate %@",searchPredicate);

NSArray* searchList = [list filteredArrayUsingPredicate:searchPredicate];

但我无法得到名单。谁能帮我 ?
    {
equipArray = (
{
equipmentIcon = "outside.png";
equipmentName = Outside;
},
{
equipmentIcon = "steps.png";
equipmentName = Steps;
},
{
equipmentIcon = "partner.png";
equipmentName = Partner;
}
);
exId = 4;
exeName = "Fireman Carry";
exerciseAudioCue = "DG Fighting Fit-exercise_audio_test.mp3";
exerciseDescription = "Proin gravida nibh vel velit auctor aliquet. Aenean sollicitudin, lorem quis bibendum auctor, nisi elit consequat ipsum, nec sagittis sem nibh id elit. Duis sed odio sit amet nibh vulputate cursus a sit amet mauris. Morbi accumsan ipsum velit. Nam nec tellus a odio tincidunt auctor a ornare odio. Sed non mauris vitae erat consequat auctor eu in elit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Mauris in erat justo. Nullam ac urna eu felis dapibus condimentum sit amet a augue. Sed non neque elit. Sed ut imperdiet nisi. Proin condimentum fermentum nunc. Etiam pharetra, erat sed fermentum feugiat, velit mauris egestas quam, ut aliquam massa nisl quis neque. Suspendisse in orci enim.";
exerciseType = Stamina;
imageThumbNail = "firemancarry_thumbnail.png";
longVideoName = long;
shortVideoName = small;
}

最佳答案

如果要查找equipmentName中任何equipArray包含以下内容的元素,
给定的字符串,使用:

[NSPredicate predicateWithFormat:@"ANY %K CONTAINS[c] %@", @"equipArray.equipmentName", textField.text];

(“CONTAINS”用于字符串比较,而不是检查数组中是否包含。)

关于ios - NSPredicate面临的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16983450/

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