3 ms·
An array of characters reversed loses the original meaning of the characters. Other than looking for palindromes, there's almost nothing in the way of practical
by bastawhiz 7y ago
An array of characters reversed loses the original meaning of the characters. Other than looking for palindromes, there's almost nothing in the way of practical uses of a reversed string that can't be accomplished by subscripting the string and iterating from the end to the beginning.
- PeCaN 7y agoIterating from back to front doesn't work either; you probably (depending on what you're doing) still have to segment into grapheme clusters—which is stateful as of unicode 9, so you have to start from the beginning of the string. And then god forbid you get U+202C POP DIRECTIONAL FORMATTING CODE....
- catlifeonmars 7y agoI found this little gem on Software engineering StackExchange: https://softwareengineering.stackexchange.com/questions/24691/what-do-you-use-string-reversal-for https://softwareengineering.stackexchange.com/questions/2469... Suffice it to say, there are many interesting uses for string reversal :)
- bastawhiz 7y agoInteresting, but questionably useful. If you're converting integer bases or obfuscating email addresses, there are much better approaches that don't involve a bad hack