Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are those strings not equal?

 NSLog(@"%@",variable);
 temp = @"(null)";
 if([variable  isEqualToString:temp])

This is the code that I use and as output I get

[4298:207] (null)

But of course for some reason they are not equal. It's beyond me to understand this. Both variables are of type NSString.

like image 873
Pillblast Avatar asked Feb 16 '26 06:02

Pillblast


1 Answers

(null) is just the output the %@ format specifier gives when the value is nil. What is in variable is nil, not the literal string (null)

like image 136
Joshua Weinberg Avatar answered Feb 17 '26 20:02

Joshua Weinberg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!