I’m looking for a nice clean routine for turning an NSArray containing NSNumbers (integers) into a nice English-readable string. For example, I want to change this:
[NSArray arrayWithObjects:[NSNumber numberWithInt:5],
[NSNumber numberWithInt:7],
[NSNumber numberWithInt:12],
[NSNumber numberWithInt:33], nil];
into this:
5, 7, 12 and 13.
Is there any nice way of doing this without hideous if statement logic? I’m sure it can be done with a regular expression, but is that possible in pre-iOS 4 code?
Thanks! 🙂
:-Joe
Look mom, no ifs!
output:
but why?
edit here is an understandable version with no “huge if/else construct”
This will output strings like