truncate

Truncates a string if it's longer than the given maximum length. The last characters of the truncated string are replaced with the ellipsis string which defaults to "...".

Example