utf8_width

Function get_width

Source
pub const fn get_width(byte: u8) -> usize
Expand description

Given a first byte, determine how many bytes are in this UTF-8 character. If the UTF-8 character is invalid, return 0; otherwise, return 1 to 4.