标签:
例如:
从一个链接中截取字段 oppo_N1mini
例如:source==<a href=http://app.weibo.com/feed/2llosp rel="nofollow">oppo_N1mini</a>
-(void)setSource:(nsstring *)source
{
//表示截取的范围
NSRange range;
//截取的开头
range.location=[source rangeOfString@">"].location+1;
//到哪个地方结束
range.length=[source rangeOfString@"</"].location-range.location;
//source substringwithRange:range 截取出来的文字
_source=[NSString stringWithFormat@"来自%@",[source substringwithRange:range]];
}
标签:
原文地址:http://www.cnblogs.com/lizhan1991/p/4794220.html