Skip to content

Instantly share code, notes, and snippets.

@vanntastic
Created January 6, 2010 20:17
Show Gist options
  • Save vanntastic/270601 to your computer and use it in GitHub Desktop.
Save vanntastic/270601 to your computer and use it in GitHub Desktop.
# should be in Ruby Core
class String
# grab the first character
def first
self[0..0]
end
# grab the last character
def last
self[(self.length-1)..(self.length-1)]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment