例如:
从一个链接中截取字段 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 [email protected]">"].location+1;
//到哪个地方结束
range.length=[source [email protected]"</"].location-range.location;
//source substringwithRange:range 截取出来的文字
_source=[NSString [email protected]"来自%@",[source substringwithRange:range]];
}
时间: 2024-11-10 07:22:29