public static string FormatString(string str)
{
str=str.Replace(" "," ");
str=str.Replace("<","^");
str=str.Replace(">","~");
str=str.Replace(",",",");
str=str.Replace("&","-");
str=str.Replace("?","?");
str=str.Replace(":",":");
str=str.Replace(""n".ToString(),"<br>");
str=str.Replace("'".ToString(),"’");
return str;
}
注释:上例是将输入数据库的关键字符转换成普通字符,另外将括号里的信息反过来写,便可按照原始的数据显示出来。
Kyle