Skip to content

Instantly share code, notes, and snippets.

@rking

rking/a.rb Secret

Created October 8, 2012 17:34
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 rking/6d72199fe81badadfa0c to your computer and use it in GitHub Desktop.
Save rking/6d72199fe81badadfa0c to your computer and use it in GitHub Desktop.
class String
def palindromic?
normalized = gsub(/\W/, '').downcase
normalized == normalized.reverse
end
end
# => nil
'asdf'.palindromic?
# => false
'fdsasdf'.palindromic?
# => true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment