fn split_string_by_codepoint(s: &str, max_len: usize) -> Vec<String> {
    let mut res = vec![];
    let mut s = s;

    while codepoint_len(s) > max_len {
        res.push(substring_by_codepoint(s, 0, max_len).into());
        s = substring_by_codepoint(s, max_len, codepoint_len(s));
    }

    if res.is_empty() || !s.is_empty() {
        res.push(format!("{:width$}", s, width = max_len));
    }

    res
}
/// Split a string into equal length parts, padding the last part if
/// necessary.
///
/// ```
/// split_string_by_codepoint("fooba", 3) // vec!["foo", "ba "]
/// ```
Split a string into equal length parts, padding the last part if
necessary.


Split a string into equal length parts padding the last part if necessary .
fn split_string_by_codepoint(s: &str, max_len: usize) -> Vec<String> {
    let mut res = vec![];
    let mut s = s;
    while codepoint_len(s) > max_len {
        res.push(substring_by_codepoint(s, 0, max_len).into());
        s = substring_by_codepoint(s, max_len, codepoint_len(s));
    }
    if res.is_empty() || !s.is_empty() {
        res.push(format!("{:width$}", s, width = max_len));
    }
    res
}
fn split_string_by_codepoint ( s : & str , max_len : usize ) -> Vec < String > { let mut res = vec ! [ ] ; let mut s = s ; while codepoint_len ( s ) > max_len { res . push ( substring_by_codepoint ( s , 0 , max_len ) . into ( ) ) ; s = substring_by_codepoint ( s , max_len , codepoint_len ( s ) ) ; } if res . is_empty ( ) || ! s . is_empty ( ) { res . push ( format ! ( " " s width max_len ) ) ; } res }
Split a string into equal length parts, padding the last part if
necessary.
Split a string into equal length parts padding the last part if necessary .
s
&str
max_len
usize