It seems, that there's no ready function in a framework, but you can do something like this:
public static String Preview(String value) {
String[] newLines = new String[] { "<br>", "<br />", "\n", "\r", Environment.NewLine };
foreach (String newLine in newLines)
value = value.Replace(newLine, ""); // <- May be space will be better here
if (text.Length > 25)
return value.Substring(0, 25) + "…";
// If you want string END, not string START, comment out the line above and uncomment this
// return value.Substring(value.Length - 25) + "…";
else
return value;
}
...
// Test sample
String text = "abcd<br>efgh\r\r\n\n1234567890zxy\n\n1234567890abc";
String result = Preview(text); // <- abcdefgh1234567890zxy1234…
String text2 = "abcd<br>efgh\r\r";
String result2 = Preview(text2); // <- abcdefgh