Ruby Newbie homepage Ruby Newbie homepage

How to use

Quick guide

Official content
Returns the count of bytes in self:
"\x80\u3042".bytesize # => 4
"hello".bytesize # => 5
Related: String#length.
 
               static VALUE
rb_str_bytesize(VALUE str)
{
    return LONG2NUM(RSTRING_LEN(str));
}
            

Was this page useful?