2 ms·
It's a bit of both. Rust strings are (guaranteed valid) UTF-8 bytes. str.len() returns the number of bytes; s.chars().count() returns the number of characters.
by paulddraper 7y ago
It's a bit of both. Rust strings are (guaranteed valid) UTF-8 bytes.
str.len() returns the number of bytes; s.chars().count() returns the number of characters.