Mega Code Archive

 
Categories / Ruby / String
 

A case-insensitive comparison is possible with casecmp, which has the same possible results as = (-1, 0, 1)

"a" <=> "A" # => 1 "a".casecmp "A" # => 0