Validate Integer

Check if a value is an integer.

Code

Utilities
value.to_i.to_s == value || value.to_i.to_s == value.gsub(/^-/, '')

Parameters

Value to validate.

Server

More Ruby Snippets