What's the Point of the prefix ? operator in Ruby 1.9

前端 未结 3 1006
天涯浪人
天涯浪人 2020-12-12 05:25

I\'m just wondering what applications it has. I believe in 1.9 the prefix ? would return the string version of that character.

?a   #=> \"a\"
?\\t  #=>         


        
3条回答
  •  南方客
    南方客 (楼主)
    2020-12-12 05:50

    You are correct, you get the string value of the characters. It was previously used to get the ASCII value of the characters.

提交回复
热议问题