Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 314 Bytes

File metadata and controls

21 lines (16 loc) · 314 Bytes

ord

We can find the ASCII value of a character in Ruby using the String#[] method. We use this method in Ruby to specify the index of the character we need.

{{code:php $result = ord("t"); var_export($result); // => 116 }}

{{code:ruby p "t"[0] # => 116 }}

{{related: strings/chr }}