Skip to content
instance method

String#ord

() -> ::Integer
ord → integer

Returns the integer ordinal of the first character of self:

Example
'h'.ord         # => 104
'hello'.ord     # => 104
'тест'.ord      # => 1090
'こんにちは'.ord  # => 12371

Related: see Converting to Non-String.

See also #oct #partition #next! #prepend also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0