truncate_and_trailoff

Function truncate_and_trailoff 

Source
pub fn truncate_and_trailoff(s: &str, max_chars: usize) -> String
Expand description

Removes characters from the end of the string if its length is greater than max_chars and appends “…” to the string. Returns string unchanged if its length is smaller than max_chars.