Compare two NSStrings

前端 未结 3 521
慢半拍i
慢半拍i 2020-12-09 02:54

In my app there is a mechanism that requires that at a certain point two NSStrings will be the same to do something; for some reason when I compare the two, eve

3条回答
  •  执笔经年
    2020-12-09 03:45

    You can use the method isEqualToString::

    if ([bString isEqualToString:aString])
    

    == compares the references (addresses of) the strings, and not the value of the strings.

提交回复
热议问题