日期:2014-05-19  浏览次数:20733 次

新手~~取字符串
string   s= " <ibsResponse> <result> 0 </result> <vodurl>   <[!CDATA[http://localhost/t1.aspx]]> </vodurl> <desc> 获取链接成功 </desc> </ibsResponse> "
如何把string   d= "http://localhost/t1.aspx "   这一串取出来,
请个位老大帮帮忙~~谢谢

------解决方案--------------------
try


string s = " <ibsResponse> <result> 0 </result> <vodurl> <[!CDATA[http://localhost/t1.aspx]]> </vodurl> <desc> 获取链接成功 </desc> </ibsResponse> ";
Match m = Regex.Match(s, @ "(? <=cdata\[)[^\]]*?(?=\]) ", RegexOptions.IgnoreCase);
string d = " ";
if (m.Success)
{
d = m.Value;
}