method
casecmp
v2_6_3 -
Show latest stable
-
0 notes -
Class: Symbol
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378 (0)
- 1_9_2_180 (6)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6 (14)
- 2_5_5 (38)
- 2_6_3 (0)
- What's this?
casecmp(p1)
public
Case-insensitive version of Symbol#<=>. Currently, case-insensitivity only works on characters A-Z/a-z, not all of Unicode. This is different from Symbol#casecmp?.
:aBcDeF.casecmp(:abcde) #=> 1 :aBcDeF.casecmp(:abcdef) #=> 0 :aBcDeF.casecmp(:abcdefg) #=> -1 :abcdef.casecmp(:ABCDEF) #=> 0
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