I'm trying to limit the number of characters in a string.
However when I try the following:
Truncate.TruncateString(_longString, 300);
I Still get spaces included beyond 300 characters. Is there an alternative so that spaces are counted within the character limit?
public static string TruncateString (this string value, int maxChars)
{
return value.Length <= maxChars ? value : value.SubString(0, maxChars) + "...";
}