国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

asp.net替換和恢復html特殊字符

2020-01-18 01:36:10
字體:
來源:轉載
供稿:網友
/// <summary>
/// 替換html中的特殊字符
/// </summary>
/// <param name="theString">需要進行替換的文本。</param>
/// <returns>替換完的文本。</returns>
public string HtmlEncode(string theString)
{
     theString=theString.Replace(">", ">");
     theString=theString.Replace("<", "<");
     theString=theString.Replace("  ", "  ");
     theString=theString.Replace("  ", "  ");
     theString=theString.Replace("/"", """);
     theString=theString.Replace("/'", "'");
     theString=theString.Replace("/n", "<br/> ");
     return theString;
}

/// <summary>
/// 恢復html中的特殊字符
/// </summary>
/// <param name="theString">需要恢復的文本。</param>
/// <returns>恢復好的文本。</returns>
public string HtmlDiscode(string theString)
{
     theString=theString.Replace(">", ">");
     theString=theString.Replace("<", "<");
     theString=theString.Replace(" "," ");
     theString=theString.Replace("  ","  ");
     theString=theString.Replace(""","/"");
     theString=theString.Replace("'","/'");
     theString=theString.Replace("<br/> ","/n");
     return theString;
}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 鄂伦春自治旗| 咸丰县| 宜黄县| 陆丰市| 精河县| 黄浦区| 青铜峡市| 原平市| 甘德县| 高州市| 宣城市| 临沧市| 准格尔旗| 楚雄市| 望奎县| 竹山县| 治多县| 师宗县| 深水埗区| 恭城| 滨海县| 出国| 陕西省| 桐庐县| 秦安县| 长沙县| 沁水县| 五峰| 云安县| 呼和浩特市| 墨脱县| 邹城市| 上栗县| 宾川县| 西乌珠穆沁旗| 阳曲县| 嫩江县| 沛县| 孟津县| 长治市| 祥云县|