October 2006
Intermediate to advanced
888 pages
16h 55m
English
In Ruby, a character is already an integer. This behavior is slated to change in 2.0 or perhaps sooner. In future versions of Ruby, the current plan is to store a character as a one-character string.
str = "Martin" print str[0] # 77
If a Fixnum is appended directly onto a string, it is converted to a character:
str2 = str << 111 # "Martino"
Read now
Unlock full access