I want to check weather a NSString
is null or not. Im assigning from an JSON array. After assigning that string value is <null>
. Now I want to check this string is null or not. So I put like this
if (myStringAuthID==nil)
but this if statement always false. How I can check a string for null. Please help me
Thanks
You can check if [string length] == 0 . This will check if it's a valid but empty string (@"") as well as if it's nil, since calling length on nil will also return 0. There are some very rare NSStrings where this will result in a false negative (saying the string isn't empty, when, for practical purposes, it is).
A static, plain-text Unicode string object which you use when you need reference semantics or other Foundation-specific behavior.
Like that:
[myString isEqual: [NSNull null]];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With