NSString *test=@"ABCDEFGHIJKLMNOPQRSTUVWXYZ";NSUInteger bytes = [test lengthOfBytesUsingEncoding:NSUTF8StringEncoding];NSLog(@"%i bytes", bytes);
To get the bytes use
NSData *bytes = [string dataUsingEncoding:NSUTF8StringEncoding];
Then you can check bytes.length
bytes.length
Number of bytes depend on the string encoding
Well:
NSString* string= @"myString";NSData* data=[string dataUsingEncoding:NSUTF8StringEncoding];NSUInteger myLength = data.length;