Hi I am trying to concatenate some string variables that may be nil. Specifically, I am taking the title, first name and last name of a contact and want to assemble the best possible name i.e. Dr. John Smith without getting any nulls in the result.
If I simply do:
NSString *title = contact.title;
NSString *first = contact.first;
NSString *last = contact.last;
NSString *bestName = [NSString stringWithFormat: @"%@ %@ %@", title, first,last];
...if any of them are null I get a (null) in the result.
Can anyone suggest efficient code to only include if the value is not null?
Thanks for any suggestions.