NSString *tmpStr = @"asd341234aaaaccd";
NSRange range;
range = [tmpStr rangeOfString:@"ccd"];
if (range.location != NSNotFound) {
NSLog(@"found at location = %lu, length = %lu",(unsigned long)range.location,(unsigned long)range.length);
NSString *ok = [tmpStr substringFromIndex:range.location];
NSLog(@"%@",ok);
}else{
NSLog(@"Not Found");
}
[iOS 转 获取字符串位置]
最新推荐文章于 2021-02-05 16:20:12 发布