public string CutDetails(object strObj) { string retStr = ""; if (strObj != null) { try { retStr = new HTMLExtracor.Extractor().Extract(strObj.ToString()); // remove html tags. (String)strObj.ToString(); Regex.Replace(retStr.ToString(), "<.*?>", string.Empty); retStr = (String)strObj.ToString().Substring(0, 70); } catch { retStr += " "; } retStr += "..."; } return(retStr); }
public static string CutDetails(object strObj, int count) { string retStr = ""; if (strObj != null) { try { /// Extract text from html. string temp = new HTMLExtracor.Extractor().Extract(strObj.ToString()); Regex.Replace(temp, "<.*?>", string.Empty); // Cut returned text. retStr = temp.Length > count?temp.Substring(0, count) + "..." : temp; } catch { retStr += "..."; } //retStr += "..."; } return(retStr); }