Function for Remove Html Tags using C# in Asp.net

Function for Remove Html Tags using C# in Asp.net

Pass string Message in ob

public string RemoveHTML(string ob)
{
string str = string.Empty;
string splitText = string.Empty;
str = Regex.Replace(ob, @”<[^>]*>”, “”, RegexOptions.Compiled);
if (str.Length > 100)
{
splitText = Server.HtmlDecode(str.Substring(0, 100) + “…”);
}
else
{
splitText = str;
}
return splitText;
}

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply