ASCII value of character in Ruby
The String#ord
method will do the trick:
ruby-1.9.2-p136 > 'x'.ord => 120 ruby-1.9.2-p136 > '0'.ord => 48 ruby-1.9.2-p136 > ' '.ord => 32
The String#ord
method will do the trick:
ruby-1.9.2-p136 > 'x'.ord => 120 ruby-1.9.2-p136 > '0'.ord => 48 ruby-1.9.2-p136 > ' '.ord => 32