0

Possible Duplicate:
What is the maximum length of an NSString object?

I'm trying to decide on a good way to store my tile data on the parse database. What I need is to store 24x24 values, not sure how long those values will be, but let's say I need to store 24x24 bytes (giving me 256 possibilities for each tile). I was thinking of storing them in a big string, is that possible? is there a limit on how big a string should be? or is there a better way to do this in objective c?

Thanks for any advice.

Community
  • 1
  • 1
Phil
  • 2,995
  • 6
  • 40
  • 67
  • Please, *don't de-normalize a database unless fully scrutinized*. Also, "256" is a very small number these days; consider all the programs that would break if strings could not be "significantly larger". –  Oct 09 '12 at 01:46

2 Answers2

2

Re: string length, I don't think there's a hard limit on the length of a string. But in terms of storing this type of data, how about a multi-dimensional array? Here's a discussion on the topic.

How to declare a two dimensional array of string type in Objective-C?

Community
  • 1
  • 1
echo
  • 7,737
  • 2
  • 35
  • 33
  • There must be a hard limit. `-[NSString length]` returns an `NSUInteger`, and `characterAtIndex:` takes one. – jscs Oct 09 '12 at 01:50
0

The maximum length is determined by the size of NSUInteger (so, billions).

This question has already been asked and answered on stackoverflow here What is the maximum length of an NSString object?

Community
  • 1
  • 1
Walter
  • 5,867
  • 2
  • 30
  • 43