1.替换目标字符串中的url 成为超链接
using System;
using System.Text.RegularExpressions;
namespace ArLi.CommonPrj
{
public class ReplaceLink
{
public ReplaceLink()
{
}
///替换目标字符串中的url 成为超链接
/// 要替换的字符串
public static string rpOf(string myStr) {
myStr += " ";
Regex myre = new Regex(@"http://\S+ ", RegexOptions.IgnoreCase);
MatchCollection mclist = myre.Matches(myStr);
foreach (Match m in mclist){
myStr = myStr.Replace(m.Value," ");
}
return myStr.Remove(myStr.Length -1,1);
}
}
}
using System;
using System.Text.RegularExpressions;
namespace ArLi.CommonPrj
{
public class ReplaceLink
{
public ReplaceLink()
{
}
///
/// 要替换的字符串
public static string rpOf(string myStr) {
myStr += " ";
Regex myre = new Regex(@"http://\S+ ", RegexOptions.IgnoreCase);
MatchCollection mclist = myre.Matches(myStr);
foreach (Match m in mclist){
myStr = myStr.Replace(m.Value," ");
}
return myStr.Remove(myStr.Length -1,1);
}
}
}
关键字词: