定位子字符串的位置

方法一

NSString *homebrew= @"ImperialIndia Pale Ale (IPA)";
//从末尾开始搜索"ia"字符串
NSRange range = [homebrew rangeOfString:@"ia"options:NSBackwardsSearch];方法一z

方法二

NSString  *tempDoucment = NSTemporaryDirectory();//获取缓存目录

NSCharacterSet *charSet = [NSCharacterSetcharacterSetWithCharactersInString:@"/"];//字符标示位    

NSRange lastCharRange = [paramFilePath rangeOfCharacterFromSet:charSet options:NSBackwardsSearch];//从末尾开始搜索"ia"字符串

posted @ 2014-04-08 14:27  leevaboo  Views(358)  Comments(0Edit  收藏  举报