I have the below coding, i am make sure that if condition is TRUE, but i can’t get into it.
i prove it by using NSLog write the value and length before and after step to the if statements, both equal to “test” and length = 4, anyone can solve my problem?
And please take a look below link which is my cap screen, please help, Thanks !!!!
http://postimage.org/image/rvtxcq1g1/
NSLog(@"Before value=%@, lenght=%i", txtMaster.text, [txtMaster.text length]);
if (txtMaster.text == @"test")
{
NSLog(@"%@\n", @"Success");
}
NSLog(@"After value=%@, lenght=%i", txtMaster.text, [txtMaster.text length]);
Using
==to compareNSStrings compares the pointer value of the strings. That’s probably not what you want. Instead, try this: