问题描述
- 在iPhonesdk中比较数据
-
使用条件语句,每次都到else语句中,if语句就没反应。if ([ [dict2 valueForKey:@"meeting_location"] isEqual:@""]) { lbllocation.text = @"-----"; } else { lbllocation.text = [NSString stringWithFormat:@"Location: %@",[dict2 valueForKey:@"meeting_location"]]; }
web服务器的输出:
"meeting_location" = ""; "meeting_time" = ""; "meeting_with" = "";
解决方案
不是isEqual而是isEqualToString
if ([ [dict2 valueForKey:@"meeting_location"] isEqualToString:@""])
时间: 2024-12-31 09:37:45