/// <summary> /// Returns the content of specified tag. /// </summary> /// <param name="pageHtml">html code</param> /// <param name="justTagName">The tag name like TABLE</param> public static string GetTagContent(ref string pageHtml, string justTagName) { string startTag = '<' + justTagName; string endTag = justTagName + '>'; int start, end; start = StringCompare.IndexOfIgnoreCase(ref pageHtml, startTag); if (start == -1) { return(""); } start = StringCompare.IndexOfMatchCase(ref pageHtml, '>', start); if (start == -1) { return(""); } start++; end = StringCompare.IndexOfIgnoreCase(ref pageHtml, endTag, start); if (end == -1) { return(""); } end = StringCompare.LastIndexOfMatchCase(ref pageHtml, '<', end); if (end == -1 || start > end) { return(""); } return(pageHtml.Substring(start, end - start).Trim()); }