No matter how much I meddle with the syntax, I cant seem to cast an item in a NSArray to a NSString.
This is the code that makes the NSArray, by dividing up a string by a separator:
So, shouldnt it be an easy thing to extract, for instance, the first name to a new string?
But it wont work, so Im guessing Im missing some sort of cast, or some other piece of syntax is wrong?
This is the code that makes the NSArray, by dividing up a string by a separator:
Code:
NSString *list = @"Norman, Stanley, Fletcher";
NSArray *listItems = [list componentsSeparatedByString:@", "];
So, shouldnt it be an easy thing to extract, for instance, the first name to a new string?
Code:
NSString *singleName = [listItems objectAtIndex:0];
But it wont work, so Im guessing Im missing some sort of cast, or some other piece of syntax is wrong?