How do I test if an NSString
is empty in Objective C?
转载于:https://stackoverflow.com/questions/899209/how-do-i-test-if-a-string-is-empty-in-objective-c
How do I test if an NSString
is empty in Objective C?
转载于:https://stackoverflow.com/questions/899209/how-do-i-test-if-a-string-is-empty-in-objective-c
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.