End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
String#chr
chr → string
string.c
View on GitHub ↗
static VALUE
rb_str_chr(VALUE str)
{
return rb_str_substr(str, 0, 1);
}
Returns a string containing the first character of self:
Example
s = 'foo' # => "foo" s.chr # => "f"