Skip to main content

truncate_utf8

Function truncate_utf8 

Source
pub fn truncate_utf8(text: &mut String, max_bytes: usize) -> bool
Expand description

Truncate text so that its UTF-8 encoded length is at most max_bytes, always keeping the result on a valid UTF-8 character boundary.

Returns true when truncation occurred.