Skip to main content

truncate_utf8_by_bytes

Function truncate_utf8_by_bytes 

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

Truncate a UTF-8 string to at most max_bytes UTF-8 bytes, never splitting a codepoint. If truncated, appends an ASCII ellipsis marker and a short suffix explaining truncation.