【发布时间】:2012-02-17 03:27:03
【问题描述】:
我比较了两个明显相同的字符串。不幸的是,我的 if 子句没有按预期工作:
NSLog(@"%@ == %@ ?",strippedString1,strippedString2);
if (strippedString1 == strippedString2) {
[_newBuild setTextColor: [NSColor greenColor] ];
[_OldBuild setTextColor: [NSColor greenColor] ];
}
这是我的 NSLog 输出:Build: 2A12-046 == Build: 2A12
即使是逐字节比较也表明两个字符串是相同的:
有什么线索吗?
【问题讨论】:
标签: objective-c string comparison