HTML特殊字元轉換

2021-05-01 00:04:01 字數 934 閱讀 9017

public static string htmlencode(string thestring)

public static string htmldiscode(string thestring)

//用正規表示式過濾html標記的

public static string dealhtml(string str)

{str = regex.replace(str, @"/<(img)[^>]*>|", "", regexoptions.ignorecase);

str = regex.replace(str, @"/<(table|tbody|tr|td|th|)[^>]*>|", "", regexoptions.ignorecase);

str = regex.replace(str, @"/<(div|blockquote|fieldset|legend)[^>]*>|", "", regexoptions.ignorecase);

str = regex.replace(str, @"/<(font|i|u|h[1-9]|s)[^>]*>|", "", regexoptions.ignorecase);

str = regex.replace(str, @"/<(style|strong)[^>]*>|", "", regexoptions.ignorecase);

str = regex.replace(str, @"/]*>|", "", regexoptions.ignorecase);

str = regex.replace(str, @"/<(meta|iframe|frame|span|tbody|layer)[^>]*>|", "", regexoptions.ignorecase);

str = regex.replace(str, @"/]*", "", regexoptions.ignorecase);

return st

HTML特殊字元

html字元實體 character entities 有些字元在html裡有特別的含義,比如小於號 就表示html tag的開始,這個小於號是不顯示在我們最終看到的網頁裡的。那如果我們希望在網頁中顯示乙個小於號,該怎麼辦呢?這就要說到html字元實體 html character entities...

HTML特殊字元大全

math symbols supported by html character entity number entity name description for all part exists exists empty nabla isin notin ni prod sum minus low...

HTML特殊字元顯示

有些字元在html裡有特別的含義,比如小於號 就表示html tag的開始,這個小於號是不顯示在我們最終看到的網頁裡的。那如果我們希望在網頁中顯示乙個小於號,該怎麼辦呢?這就要說 到html字元實體 html character entities 了。乙個字元實體 character entity ...