Reputation: 2201
ok..so i'm reading from an sqlite db data into a string...it works..but when the data is null there is a problem
NSLog(@"%@",string);
if(string!=NULL && [string length]!=0){ do stuff }
note that the NSLog output is <null>
not NULL
or nil
and i think here is the problem...i'm trying to check for NULL
when the string is <null>
does that make sence?
in any case...is there any way to check if the string is <null>
? or is there a better way to check for this problem?
Upvotes: 0
Views: 559
Reputation: 28242
<null>
is what the description
method on NSNull
prints out. You should also check for string != [NSNull null]
.
(NSNull
is a placeholder singleton for collections, where actual nil
values aren't allowed.)
Upvotes: 1