Saturday, October 26, 2013

Remove Html tag from String

public string Strip(string text)
 {
     string s = Regex.Replace(text, @”<(.|\n)*?>”, string.Empty);
     s = s.Replace("&nbsp;", " ");
     s = Regex.Replace(s, @"\s+", " ");
     s = Regex.Replace(s, @"\n+", "\n");
     return s;
 }
 

0 comments:

Post a Comment