Hope somebody has a good idea. I have strings like this:
abcdefg abcde abc
What I need is for them to be trucated to show like this if more
Here's a version that accounts for the length of the ellipses:
public static string Truncate(this string value, int maxChars) { const string ellipses = "..."; return value.Length <= maxChars ? value : value.Substring(0, maxChars - ellipses.Length) + ellipses; }