Maintenance Ruby 3.3 gets fixes, but no new features. 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"