Skip to main content

floor_char_boundary

Function floor_char_boundary 

Source
pub fn floor_char_boundary(s: &str, max_bytes: usize) -> usize
Expand description

Largest byte index <= max_bytes that is a char boundary of s.

O(1): a UTF-8 sequence is at most 4 bytes, so the nearest boundary is at most 3 bytes back.