2011年11月26日 星期六

Asp.net 去除Html<>裡標籤

因為常使用CKEditor,所以在如果字數很多的時後會常做到More這個功能

這時就必需要將Html標籤給去除掉才有辦法只顯示出純文字,這時就需要這個Function啦

傳入一整個Ckeidtor文字。
///  
/// 去除Html標籤 
///  
///
傳入一整個Ckeidtor文字。
public static string ReplaceHtmlTag(string Html)
{
Html = Regex.Replace(Html, "<[^>]*>", "");
return Html;
}