Mega Code Archive

 
Categories / Ruby / String
 

Specify a Fixnum (integer) as an index, it returns the decimal character code for the character found at the index location

line = "A horse! a horse! my kingdom for a horse!" puts line[7]  # At the location 7, [] found the character 33 (!).