/// <summary> /// Removes HTML elements from a string /// </summary> /// <param name="HTML">HTML laiden string</param> /// <returns>HTML-less string</returns> public static string StripHTML(this string HTML) { if (string.IsNullOrEmpty(HTML)) { return(""); } HTML = STRIP_HTML_REGEX.Replace(HTML, string.Empty); return(HTML.Replace(" ", " ") .Replace(" ", string.Empty)); }
/// <summary> /// Decides if the string contains HTML /// </summary> /// <param name="Input">Input string to check</param> /// <returns>false if it does not contain HTML, true otherwise</returns> public static bool ContainsHTML(this string Input) { return(string.IsNullOrEmpty(Input) ? false : STRIP_HTML_REGEX.IsMatch(Input)); }