instance method
String#casecmp?
(::string other) -> bool
(untyped) -> bool?
casecmp?(other_string) → true, false, or nil
string.c
View on GitHub ↗
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);
}
Returns true if self and other_string are equal after Unicode case folding, false if unequal, nil if incomparable.
See Case Mapping.
Examples:
Example
'foo'.casecmp?('goo') # => false 'goo'.casecmp?('foo') # => false 'foo'.casecmp?('food') # => false 'food'.casecmp?('foo') # => false 'FOO'.casecmp?('foo') # => true 'foo'.casecmp?('FOO') # => true 'foo'.casecmp?(1) # => nil
Related: see Comparing.