Ruby Newbie homepage Ruby Newbie homepage

How to use

Quick guide

Official content
Returns true if self and other_string are equal after Unicode case folding, otherwise false:
'foo'.casecmp?('foo') # => true
'foo'.casecmp?('food') # => false
'food'.casecmp?('foo') # => false
'FOO'.casecmp?('foo') # => true
'foo'.casecmp?('FOO') # => true
Returns nil if the two values are incomparable:
'foo'.casecmp?(1) # => nil
Related: String#casecmp.
 
               static VALUE
rb_str_casecmp_p(VALUE str1, VALUE str2)
{
    VALUE s = rb_check_string_type(str2);
    if (NIL_P(s)) {
        return Qnil;
    }
    return str_casecmp_p(str1, s);
}
            

Was this page useful?