iOS NSString 截取 从第n个到第m个
NSString *str = @"<a href=\"http://weibo.com/\" rel=\"nofollow\">微博 weibo.com</a>";
//只需要 (微博 weibo.com</a>)中的 weibo.com
//第n个
long int begin = [str rangeOfString:@">"].location + 1;
//第m个
long int end = [str rangeOfString:@"</"].location;
NSString * target = [NSString stringWithFormat:@"来自%@", [str substringWithRange:NSMakeRange(begin, end - begin)]];
NSLog(@"target=%@",target);
//打印
2015-04-20 15:26:01.410 调试技巧[23655:330516] target=来自微博 weibo.com