If “a == b” is false when comparing two NSString objects

前端 未结 5 1644
梦毁少年i
梦毁少年i 2020-11-27 23:21

I have a class with an accessible method that passes back an NSString when called.

[MyClass getMyString]

The string variable

5条回答
  •  一整个雨季
    2020-11-27 23:58

    You can not compare the two string using "==" this is for int and other values. you can use below code for the comparing two string

    if ([Firststring isEqualToString:Secondstring]) {

      NSLog(@"Hello this both string is same ");
    

    }

提交回复
热议问题