【发布时间】:2012-05-24 12:57:37
【问题描述】:
我有这条线...
if(![[[array objectAtIndex:indexPath.row] objectForKey:@"special_trip"] isEqualToString:@""]) {
一切都很酷.. 但是我的 special_trip 有很多信息,所以我想仅以具有字符串 Airport in 的结果为例:1:Airport, Packet
我只想获取那些在整个字符串中包含 Airport 的结果。
提前致谢。
编辑:抱歉造成混淆。
【问题讨论】:
-
我可能会误会,但如果你想检查的话,你不能直接做
isEqualToString:@"Airport"吗? -
if([[[array objectAtIndex:indexPath.row] objectForKey:@"special_trip"]){//has string}else{//no value}。提供 [[[array objectAtIndex:indexPath.row] objectForKey:@"special_trip"] 输出以查找您的字符串
-
艾米是我做的,但是special_trip可能有这个:1:机场,包2:机场3:机场,包,信
-
谢谢大家.. 我这样做了: if([[[array objectAtIndex:indexPath.row] objectForKey:@"special_trip"] rangeOfString:@"port"].location != NSNotFound) {