The NSString class provides a lot of useful methods, one of these gives you the capability to extract the first n characters from an NSString

imagine you have the following NSString

NSString *originalString=@"My NSString";

to extract the first two characters, simply type the following line:

NSstring *firstTwoCharsString= [originalString substringToIndex:2];

at this point firstTwoCharsString contains "My".

You can obtain the last n characters of a string simply typing the following line of code:

NSstring *lastTwoCharsString= [originalString substringFromIndex:[originalString length]-2];

That's all,