public string htmldecode(string strhtmlcode)
{
if (!string.IsNullOrEmpty(strhtmlcode))
{
strhtmlcode = strhtmlcode.Replace("'", Convert.ToChar(39).ToString());
strhtmlcode = strhtmlcode.Replace("\"", Convert.ToChar(34).ToString());
strhtmlcode = strhtmlcode.Replace(" ", Convert.ToChar(32).ToString());
strhtmlcode = strhtmlcode.Replace("'", "''");
strhtmlcode = strhtmlcode.Replace("<", "<");
strhtmlcode = strhtmlcode.Replace(">", ">");
strhtmlcode = strhtmlcode.Replace("&", "&");
}
return strhtmlcode;
}
这段代码有问题,会报错的,前两行替换回车的,我没办法,会报错,还有返回值不应该写在if里面的
我移出来了
if(!strhtmlcode.isdbnull() && !strhtmlcode.isnothing())
{
strhtmlcode = strhtmlcode.replace("",chr(39))
}
你代码的语法有问题 http://www.codechanger.com/这里有在线转的
这个很好转换哦,如果C#熟悉的话