Florian Gilcher wrote: > On Mar 1, 2010, at 1:31 PM, Alexander Bubnov wrote: > > > Ruby 1.8 sees strings as a sequence of bytes. So > > "a"[0] #=> 97 > > yields 97 (because 97 is the value representing the character a in an > ASCII-String). If you want to compare this to some character, you need > the character code of "a" (because no one wants to have an ASCII-Table > next to them when programming). ?a gives you the character code of a. So > > "a"[0] == ?a #=> true > "a"[0] == "a" #=> false > > Now, things have changed in the String world in Ruby 1.9. Strings now > know their encoding and return charactes instead of codepoints when > accessing single characters. > > "a"[0] #=> "a" > > To make sure that legacy applications do not break, ?a will now return > "a", so now the behaviour is as follows: > > "a"[0] == ?a #=> true > "a"[0] == "a" #=> true > > Regards, > Florian Gilcher Thank you! Have you ever see something about '?' in specification of ruby1.9? If so can you please point to that doc. Unfortunately I cannot find anything about it but I would like to know it because, for example, in ruby1.10 it can be changed in once day. -- Posted via http://www.ruby-forum.com/.