Method: String#bytesize

Defined in:
string.c

#bytesizeInteger

Returns the count of bytes in self:

"\x80\u3042".bytesize # => 4
"hello".bytesize # => 5

Related: String#length.

Returns:

[View source]

1986
1987
1988
1989
1990
# File 'string.c', line 1986

static VALUE
rb_str_bytesize(VALUE str)
{
    return LONG2NUM(RSTRING_LEN(str));
}