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)


2002
2003
2004
2005
2006
2007
2008
# File 'string.c', line 2002

static VALUE
rb_str_empty(VALUE str)
{
    if (RSTRING_LEN(str) == 0)
	return Qtrue;
    return Qfalse;
}