I have an object which I am not sure is an NSString or not (could be NSNull, for example when reading a json into an NSDictionary) and I would like to get an NSString* if it is a valid string, nil otherwise.
Is there an accepted way of doing this except writing my own function?
+(NSString*)stringWithMaybeString:(id)maybeString {
if ( [maybeString isKindOfClass:[NSString class]] )
return maybeString;
return nil;
}