Truncates a string to a maximum length and appends a suffix if needed.
The string to truncate.
The maximum length of the resulting string including the suffix.
The string to append if truncation occurs (default: "…").
The truncated string with suffix if truncated.
1.1.0
truncate("Hello World", 5); // "He…"truncate("Hello", 10); // "Hello"truncate("Hello", 2); // "…" Copy
truncate("Hello World", 5); // "He…"truncate("Hello", 10); // "Hello"truncate("Hello", 2); // "…"
Truncates a string to a maximum length and appends a suffix if needed.