logixologist
logixologist

Reputation: 3834

How to perform ISNULL check on NSString without IF/THEN

Many programming languages have an easier way to handle if a string is null. Is there anything with NSSTring that you can use without having to use if then.

I am showing some data in a tableview cell and sometimes the data is really null I dont want the ugly (NULL) showing up in my cell.

Thanks!

Upvotes: 0

Views: 248

Answers (1)

Davyd Geyl
Davyd Geyl

Reputation: 4623

SQL is not a procedural language, this is why you need an inline function like ISNULL, which can be used within SELECT statement for example. It does not mean it is simpler, it was designed for a specific need.

The ternary conditional operator ?: may be used in C to have a similar implementation:

(condition ? YES : NO)

where condition is the actual comparison. Otherwise, you can design any custom function you need.

Upvotes: 2

Related Questions