Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcode cut last characters from string

I am working on a Xcode program and need to cut the last 5 characters from a string.

Does anybody know how to cut the last 5 characters from a NSString?

like image 927
DennisW83 Avatar asked Apr 19 '11 15:04

DennisW83


1 Answers

just looked for it my self few minutes ago

NSString *str = @"1234567890";
NSString *newStr;

newStr = [str substringToIndex:[str length]-5];

NSLog(@"%@", newStr);
like image 82
Philip Kramer Avatar answered Nov 15 '22 21:11

Philip Kramer