views:

27

answers:

1

Say I have a string:

NSString *state = @"California, CA";

Can someone please tell me how to extract the last two characters from this string (@"CA" in this example)

+2  A: 
NSString *code = [state substringFromIndex: [state length] - 2];

should do it

Ferruccio
thanks.. your a lifesaver.
dpigera