Code:
///<summary>
///method to strip HTML tags from a string
///</summary>
///<param name="str">the string to strip</param>
///<returns></returns>
///<remarks></remarks>
public string StripHTML(string str)
{
try
{
int start = 0;
int end = 0;
int count = 0;
while (((str.IndexOf("<") > -1) && (str.IndexOf(">") > -1) && (str.IndexOf("<") < str.IndexOf(">"))))
{
start = str.IndexOf("<");
end = str.IndexOf(">");
count = end - start + 1;
str = str.Remove(start, count);
}
str = str.Replace(" ", " ");
str = str.Replace(">", "");
str = str.Replace("\r\n", "");
return str.Trim();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
Enjoy.