Obj-c Turning long string into multidimensional array

Posted by Phil on Stack Overflow See other posts from Stack Overflow or by Phil
Published on 2012-10-28T19:46:10Z Indexed on 2012/11/01 23:01 UTC
Read the original article Hit count: 188

Filed under:

I have a long NSString, something like "t00010000t00020000t00030000" and so on. I need to split that up into each "t0001000".

I'm using...

NSArray *tileData = [[GameP objectForKey:@"map"] componentsSeparatedByString:@"t"];

And it splits it up, but the "t" is missing, which I need (although I think I could append it back on). The other way I guess would be to split it up by counting 8 char's, although not sure how to do that.

But ideally I need it split into a [][] type array so I can get to each bit with something like...

NSString tile = [[tileData objectAtIndex:i] objectAtIndex:j]];

I'm new to obj-c so thanks for any help.

© Stack Overflow or respective owner

Related posts about ios