What is the best was to determine if an NSString is empty? Right now I am using the following:
if (string == nil || [string isEqualToString:@""]) {
// do something }
Thanks for any advice.
What is the best was to determine if an NSString is empty? Right now I am using the following:
if (string == nil || [string isEqualToString:@""]) {
// do something }
Thanks for any advice.
if ([string length] == 0) {
// do something
}
If the string is nil
, then the message to nil
will return zero, and all will still be well.