やったこと
Ruby で casecmp を使ってみます。
確認環境
$ ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin17]
調査
$ irb
...
irb(main):007:0> words = ['abc', 'Abc', 'ABC', 'aaa']
=> ["abc", "Abc", "ABC", "aaa"]
irb(main):008:0> words.each do |r|
irb(main):009:1* p r.casecmp('abc')
irb(main):010:1> p 'abc'.casecmp(r)
irb(main):011:1> p 'end!!!'
irb(main):012:1> end
0
0
"end!!!"
0
0
"end!!!"
0
0
"end!!!"
-1
1
"end!!!"
=> ["abc", "Abc", "ABC", "aaa"]