Skip to main content

truncate_utf8_tail

Function truncate_utf8_tail 

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

Take the last max_bytes of a UTF-8 string without splitting code points.

Returns a string with a ...[truncated]... prefix when truncated.