Method: String#empty?

Defined in:
string.c

#empty?Boolean

Returns true if the length of self is zero, false otherwise:

"hello".empty? # => false
" ".empty? # => false
"".empty? # => true

Returns:

  • (Boolean)

2387
2388
2389
2390
2391
# File 'string.c', line 2387

static VALUE
rb_str_empty(VALUE str)
{
    return RBOOL(RSTRING_LEN(str) == 0);
}