Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

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

DZone's Guide to

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

·
Free Resource
# 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
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}