truncate_string_with_enter

Function truncate_string_with_enter 

Source
pub fn truncate_string_with_enter(
    s: &str,
    length: usize,
    encoding: Encoding,
) -> Result<(Vec<u8>, Option<&str>)>
Available on crate feature utils-str only.
Expand description

Truncate a string to a specified length, encoding it with the given encoding. Output size may less than or equal to the specified length. Returns the encoded bytes and the remaining string. Will try splitting at line breaks first.