I've a question about NSString internals. I want to check a string length and basically I wanted to know if a NSString knows its length / count each time / count & cache the result.
Should I store it's length and compute or call the length method each time ?
To test a string I can test against nil OR ask for it's length.
if (str != nil) {
// compute
}
if ([str length]) {
// compute
}
Which one is the fastest ? Which one is the more memory efficient ?
Thanks