End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
String#ord
ord → integer
string.c
View on GitHub ↗
static VALUE
rb_str_ord(VALUE s)
{
unsigned int c;
c = rb_enc_codepoint(RSTRING_PTR(s), RSTRING_END(s), STR_ENC_GET(s));
return UINT2NUM(c);
}
Returns the integer ordinal of the first character of self:
Example
'h'.ord # => 104 'hello'.ord # => 104 'тест'.ord # => 1090 'こんにちは'.ord # => 12371