How to check the NULL value in NSString in iOS?

前端 未结 10 1617
盖世英雄少女心
盖世英雄少女心 2021-01-02 15:17

I have an NSString and I want to check if it has a NULL value. If it does, then the if condition should execute. Else it should execut

10条回答
  •  滥情空心
    2021-01-02 15:57

    Its better to be on safer side in checking null values , as it can lead to crash.

    if (![string isKindOfClass:[NSNull class]] && string && string != NULL) 
    

提交回复
热议问题