Created
August 19, 2014 05:23
-
-
Save federicobucchi/73913a81268b66b17490 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def reverseString | |
(self.length / 2).times {|i| self[i], self[-i-1] = self[-i-1], self[i]} | |
self | |
end | |
end | |
puts 'fede'.reverseString |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment