Skip to main content

truncate_str

Function truncate_str 

Source
pub fn truncate_str(input: &str, max_len: usize) -> String
Expand description

Truncate input to at most max_len bytes, snapping back to the nearest UTF-8 character boundary so multi-byte sequences are never split.

When the input is longer than max_len, an ellipsis is appended.