End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
String#chr
string.chr → string
string.c
View on GitHub ↗
static VALUE
rb_str_chr(VALUE str)
{
return rb_str_substr(str, 0, 1);
}
Returns a one-character string at the beginning of the string.
Example
a = "abcde" a.chr #=> "a"