Trims a string to a specified maximum length and adds an ellipsis (…) if the string exceeds the limit.
…
The string to trim.
The maximum length of the string before truncation (default is 36).
The truncated string with an ellipsis if it exceeds the specified length.
clampString('This is a long string', 10); // Returns 'This is a …' Copy
clampString('This is a long string', 10); // Returns 'This is a …'
Trims a string to a specified maximum length and adds an ellipsis (
…
) if the string exceeds the limit.