Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
To calculate the length of a Rust string s in Unicode code points, use
s.chars().count()
You can calculate the length in grapheme clusters using the unicode-segmentation crate from crates.io. It also does other cool things like words and sentences.
Add Comment
Please, Sign In to add comment