code_junkie

What's the opposite of chr() in Ruby?

Nov 12th, 2011
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. >> 65.chr
  2. A
  3.  
  4. "A".each_byte do |byte|
  5. puts byte
  6. end
  7.  
  8. 65
  9.  
  10. puts ?A
  11. 'A'[0]
  12.  
  13. puts ?A
  14. 'A'[0]
  15.  
  16. 'A'[0].ord
  17.  
  18. 'A'.unpack('c')
  19.  
  20. puts 'Az'[0]
  21. => 65
  22. puts 'Az'[1]
  23. => 122
Add Comment
Please, Sign In to add comment