iOS 截取字符串中两个指定字符串中间的字符串
- (void)viewDidLoad {
[super viewDidLoad];
NSString *string = @"<a href=\"http\">这是要截取的内容</a>";
NSRange startRange = [string rangeOfString:@"\">"];
NSRange endRange = [string rangeOfString:@"</"];
NSRange range = NSMakeRange(startRange.location + startRange.length, endRange.location - startRange.location - startRange.length);
NSString *result = [string substringWithRange:range];
NSLog(@"%@",result);
}
本文标题:iOS 截取字符串中两个指定字符串中间的字符串
本文链接:https://www.haomeiwen.com/subject/mcraqxtx.html
网友评论