Skip to content

Instantly share code, notes, and snippets.

@federicobucchi
Created August 19, 2014 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save federicobucchi/73913a81268b66b17490 to your computer and use it in GitHub Desktop.
Save federicobucchi/73913a81268b66b17490 to your computer and use it in GitHub Desktop.
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