2 ms·
For what it's worth, Rust's string length tells you the number of conventional characters, whilst following typical programming notation rules.
by cturner 6y ago
For what it's worth, Rust's string length tells you the number of conventional characters, whilst following typical programming notation rules.
- FreeFull 6y agoRust's .len() on string does not give you the length in characters, it gives you the length in bytes. If you want the length in unicode codepoints, you need to do .chars().count(), but given things like combining characters, that might not be quite what you want either.