且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

比较objective-C中的2个字符串

更新时间:2023-02-12 19:19:35

当您在指针上使用 == code> NSString * 它是比较内存地址,不比较字符串的值。

When you use an == on pointers like NSString * it is comparing memory addresses, not comparing the value of strings.

下面将实际比较字符串值:

The following will actually compare the string values:

if([date isEqualToString:choosedDate])