pub fn truncate(s: &str, max_len: usize) -> StringExpand description
Truncate a string to max_len characters.
If the string is longer than max_len, it is cut and ... is appended.
max_len must be at least 4 — otherwise the ellipsis itself would not fit.
§Examples
use dotenv_space::utils::string::truncate;
assert_eq!(truncate("hello world", 8), "hello...");
assert_eq!(truncate("hi", 10), "hi");