Y
Hacker News
new
|
ask
|
show
|
jobs
by
inamberclad
2392 days ago
I think Rust strings are all Unicode native, though they can be transmuted to bytes.
1 comments
paulddraper
2392 days 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.
link
str.len() returns the number of bytes; s.chars().count() returns the number of characters.