gpt4 book ai didi

objective-c - objective-c 中的 NOT(!)

转载 作者:搜寻专家 更新时间:2023-10-30 19:56:54 26 4
gpt4 key购买 nike

for (int i=0 ; i<=[secondSplitArrayValue count]; i++)   
{
if (![[secondSplitArrayValue objectAtIndex:i] isEqualToString:@"NULL"] ||
![[splitArrayValue objectAtIndex:i] isEqualToString:@"Error"]
{
[secondSplitArrayValue removeObjectAtIndex:i];
}
}

我正在尝试删除字符串不等于 (!=) 到 NULL 或错误的特定索引处的数组值。但是在调试时对象被删除了 NULL 和 Error 存在的地方,但我想删除 Null 和 Error 不存在的对象。

最佳答案

我想你可能正在寻找这个:

for (int i=0 ; i<=[secondSplitArrayValue count]; i++)   
{
if (!([[secondSplitArrayValue objectAtIndex:i] isEqualToString:@"NULL"] ||
[[splitArrayValue objectAtIndex:i] isEqualToString:@"Error"])
{
[secondSplitArrayValue removeObjectAtIndex:i];
}
}

这样,只有在完成两种情况的检查以及两种结果检查的 OR 运算后,您才能反转 bool 运算。

关于objective-c - objective-c 中的 NOT(!),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5742324/

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