I’m trying this code…
NSString *tileString = [[NSString alloc] init];
for (int i = 0; i < [[GameP objectForKey:@"groundMap"] length]; i += 5) {
tileString = [[GameP objectForKey:@"groundMap"] substringWithRange:NSMakeRange(i, 5)];
[tileString stringByAppendingString:@"0000"];
[sharedInstance.groundMap addObject:tileString];
}
The 5 char string that’s coming from the object is “t0001”, so I want to end up with “t0001000” but it’s not working, when I check sharedInstance.groundMap all the strings in the array are still “t0001”
Should I be using NSMutableString instead?
You aren’t assigning the result. Change this:
to:
There’s a little more cleanup you can do too: