62,046
社区成员
发帖
与我相关
我的任务
分享
//將html轉為text
public string HtmlToText(string strContent)
{
strContent = strContent.Replace("&", "&");
strContent = strContent.Replace("''", "'");
strContent = strContent.Replace("<", "<");
strContent = strContent.Replace(">", ">");
strContent = strContent.Replace("<", "chr(60)");
strContent = strContent.Replace(">", "chr(37)");
strContent = strContent.Replace(""", "\"");
strContent = strContent.Replace(";", ";");
strContent = strContent.Replace("<br />", "\n");
strContent = strContent.Replace(" ", " ");
return strContent;
}
//將text轉為html
public string TextToHtml(string strContent)
{
strContent = strContent.Replace("&", "&");
strContent = strContent.Replace("'", "''");
strContent = strContent.Replace("<", "<");
strContent = strContent.Replace(">", ">");
strContent = strContent.Replace("chr(60)", "<");
strContent = strContent.Replace("chr(37)", ">");
strContent = strContent.Replace("\"", """);
strContent = strContent.Replace(";", ";");
strContent = strContent.Replace("\n", "<br/>");
strContent = strContent.Replace(" ", " ");
return strContent;
}