3 ms·
You certainly can. `print(String(flag.reversed()))` in Swift reverses emojis correctly.
by viktorcode 5y ago
You certainly can.
`print(String(flag.reversed()))` in Swift reverses emojis correctly.
- account42 5y agoHow does it handle the ASCII examples in https://news.ycombinator.com/item?id=30108184 https://news.ycombinator.com/item?id=30108184 And more importantly: What is the use case for a reversed string?
- Etherlord87 5y agoThe use case: Make an animation, where the text appears starting from the end - for example if you stylize it as vertical text falling from the top. I think the example shows quite clearly the problem really comes down to dividing the string to logical parts (atoms, grapheme clusters, however you want to call it).