pub fn shrink_with_ellipsis(s: &str, max_length: usize) -> String
Expand description
Shrink a string to a maximum length, adding an ellipsis in the middle.
If the string is shorter than the maximum length, it is returned as is. If the string is longer than the maximum length, it is shortened and an ellipsis is added in the middle.
§Examples
use television_utils::strings::shrink_with_ellipsis;
let s = "Hello, World!";
assert_eq!(shrink_with_ellipsis(s, 13), "Hello, World!");
assert_eq!(shrink_with_ellipsis(s, 6), "H…!");