Truncates a string to a specified maximum length and appends '...' if the string was truncated.
The string to truncate.
The maximum length of the string after truncation.
The truncated string, or the original string if it was shorter than the maximum length.
Truncates a string to a specified maximum length and appends '...' if the string was truncated.