I am using NSString
and I want to get a substring of it that contains the first 20 characters of my string. How can I do that?
You can use substringToIndex
.
NSString *mystring = @"This is a test message having more than 20 characters";
NSString *newString = [mystring substringToIndex:20];
NSLog(@"%@", newString);