DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Fred has posted 10 posts at DZone. View Full User Profile

Determine If A String Represents An Integer One-liner In Ruby

08.07.2010
| 492 views |
  • submit to reddit
        # Determine if a string represents an integer
# http://www.pixellatedvisions.com/2009/06/22/string-is-a-number#comment-70

  foo.to_i.to_s == foo