文字格式转换(Text与Html)
![](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
public string writeStr(string oldStr)
{
//oldStr=oldStr.Replace("''","'");
oldStr = oldStr.Replace(" ", " ");
oldStr = oldStr.Replace("<", "<");
oldStr = oldStr.Replace(">", ">");
oldStr = oldStr.Replace("<br/>", "\n");
oldStr = oldStr.Replace(" ", "\t");
oldStr = oldStr.Replace(""", "\"");
return oldStr;
}
public string readStr(string oldStr)
{
//oldStr=oldStr.Replace("'","''");
oldStr = oldStr.Replace(" ", " ");
oldStr = oldStr.Replace("<", "<");
oldStr = oldStr.Replace(">", ">");
oldStr = oldStr.Replace("\n", "<br/>");
oldStr = oldStr.Replace("\t", " ");
oldStr = oldStr.Replace("\"", """);
return oldStr;
}
{
//oldStr=oldStr.Replace("''","'");
oldStr = oldStr.Replace(" ", " ");
oldStr = oldStr.Replace("<", "<");
oldStr = oldStr.Replace(">", ">");
oldStr = oldStr.Replace("<br/>", "\n");
oldStr = oldStr.Replace(" ", "\t");
oldStr = oldStr.Replace(""", "\"");
return oldStr;
}
public string readStr(string oldStr)
{
//oldStr=oldStr.Replace("'","''");
oldStr = oldStr.Replace(" ", " ");
oldStr = oldStr.Replace("<", "<");
oldStr = oldStr.Replace(">", ">");
oldStr = oldStr.Replace("\n", "<br/>");
oldStr = oldStr.Replace("\t", " ");
oldStr = oldStr.Replace("\"", """);
return oldStr;
}
在提交文章的时候把换行符Convert.ToString((char)13) + Convert.ToString((char)10)替换成HTML代码</P>、<BR>什么的