APIdock / Ruby
/
method

casecmp?

ruby latest stable - Class: Symbol
casecmp?(p1)
public

Returns true if sym and other_symbol are equal after Unicode case folding, false if they are not equal.

:aBcDeF.casecmp? (:abcde) #=> false
:aBcDeF.casecmp? (:abcdef) #=> true
:aBcDeF.casecmp? (:abcdefg) #=> false
:abcdef.casecmp? (:ABCDEF) #=> true
:"\u{e4 f6 fc}".casecmp? (:"\u{c4 d6 dc}") #=> true

nil is returned if the two symbols have incompatible encodings, or if other_symbol is not a symbol.

:foo.casecmp? (2) #=> nil
"\u{e4 f6 fc}".encode("ISO-8859-1").to_sym .casecmp? (:"\u{c4 d6 dc}") #=> nil
static VALUE
sym_casecmp_p(VALUE sym, VALUE other)
{
 if (!SYMBOL_P(other)) {
 return Qnil;
 }
 return str_casecmp_p(rb_sym2str(sym), rb_sym2str(other));
}

AltStyle によって変換されたページ (->オリジナル) /