Skip to main content

truncar_utf8

Function truncar_utf8 

Source
pub fn truncar_utf8(conteudo: &str, max_chars: usize) -> (String, bool)
Expand description

Trunca uma string UTF-8 a no máximo max_chars codepoints.

Retorna (string_truncada, truncou). Se max_chars == 0 retorna string vazia. Unicode-safe: opera sobre codepoints via chars(), nunca quebra no meio.