pub fn truncate(s: &str, max_len: usize) -> StringExpand description
Truncate string to max length with ellipsis
ยงExample
assert_eq!(truncate("Hello World", 8), "Hello...");
assert_eq!(truncate("Hi", 10), "Hi");
assert_eq!(truncate("Exact", 5), "Exact");