3 ms·
It does for multi-codepoint characters (such as the rainbow flag): https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a85e284cee100cdca7b3b
by natanbc 5y ago
It does for multi-codepoint characters (such as the rainbow flag): https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a85e284cee100cdca7b3b6a7c229cf1e https://play.rust-lang.org/?version=stable&mode=debug&editio...
Elixir gets it right: https://replit.com/@natanbc/reverse https://replit.com/@natanbc/reverse
- brundolf 5y agoYeah, another commenter mentioned grapheme-clusters, though apparently there's a readily available crate that adds support: https://stackoverflow.com/questions/58770462/how-to-iterate-over-unicode-grapheme-clusters-in-rust/58770681#58770681 https://stackoverflow.com/questions/58770462/how-to-iterate-... According to this they added it to the standard library at one point but then broke it back out because the lookup tables were too large
- pjgalbraith 5y agoHere is a working rust version https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=bdbea9d96e02af9ada180c6b4d1b4d8e https://play.rust-lang.org/?version=stable&mode=debug&editio...