Shortest way to reverse a string in programming languages 2 points by aligajani 11y ago ↗ HN My vote goes to Python: [::-1]Can your's do better? Better here is "shorter"
[–] dalke 11y ago ↗ As usual, APL wins: ⌽'string' . In J that's |.'string' .See http://rosettacode.org/wiki/Reverse_a_string for plenty of other examples. [–] aligajani 11y ago ↗ Interesting, how would one go about finding ⌽ on a keyboard. [–] boo_radley 11y ago ↗ In the usual way, of course.
[–] aligajani 11y ago ↗ Interesting, how would one go about finding ⌽ on a keyboard. [–] boo_radley 11y ago ↗ In the usual way, of course.
[–] JCJoverTCP 11y ago ↗ if length of the string is 1, this may shorten some answers, no? [–] aligajani 11y ago ↗ Well, in Python the reversing is as short as a print [–] kjs3 11y ago ↗ Sure...same as if the cow is spherical.
6 comments
[ 5.1 ms ] story [ 26.5 ms ] threadSee http://rosettacode.org/wiki/Reverse_a_string for plenty of other examples.