I don’t want to peek at any of the solutions. I may be doing things the difficult way, I often do! But I’d like for anyone to take a look at this code snippet and beat it into my brain as to why it doesn’t work.[code]…
NSArray *names = [nameString componentsSeparatedByString:@"\n"];
long nameCount = [names count];
NSLog(@“The names array has ->%@<- entries.”, [NSString stringWithFormat:@"%l", nameCount]);
…[/code]The first line is self-explanatory, just dumping the list of names into the MSArray called names.
The second line I figured out through some searching. It just supplies the count of items in the array. (I’m using a long assuming a short int might not be big enough sometimes and that is the reason for the @"%l". But I don’t think that affects the problem.) Reason I wanted that is to set up a for-loop. Whether that is really the way to run throughout the names is not my question, right now, Mr. Hillegass probably wants us to use the fast enumeration method. But I wanted to do some checking on the data first, so I’m doing it the long (hard?) way. I suppose one could check for a nil to stop the loop, but that seemed both “brute force” and time consuming.
I have managed to see “1309” on the variables side of the Xcode window when my code crashed a few times. That may or may not be the number names, I’m just off on this tangent assuming I might actually learn something! BTW, the output of the above code is:
The names array has -><- entries.As you can see, the value of nameCount is missing.
Thanks for any help!