Over a million developers have joined DZone.

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

·
# 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:

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

{{ parent.tldr }}

{{ parent.urlSource.name }}