I'm trying to create an NSMutableArray of characters.
lowerCaseLetters = [NSMutableArray new];
for (char crt = 'a'; crt <= 'z'; crt ++) {
NSString *chrStr = [NSString stringWithCString:&crt encoding:NSUTF8StringEncoding];
[lowerCaseLetters addObject:chrStr];
}
NSLog(@"%@",lowerCaseLetters);
Result:
"a@Ip",
"b@Ip",
"c@Ip",
"d@Ip",
"e@Ip",
"f@Ip",
"g@Ip",
"h@Ip",
"i@Ip",
"j@Ip",
"k@Ip",
"l@Ip",
"m@Ip",
"n@Ip",
"o@Ip",
"p@Ip",
"q@Ip",
"r@Ip",
"s@Ip",
"t@Ip",
"u@Ip",
"v@Ip",
"w@Ip",
"x@Ip",
"y@Ip",
"z@Ip"
)
Why do I get this? Is there a better way to do this? PS: Sometimes this crashes with "insertObject:atIndex:" can not insert nil object.... Why?