Programming-Idioms

History of Idiom 213 > diff from v1 to v2

Edit summary for version 2 :
New Ruby implementation by user [steenslag]

Version 1

2019-10-30, 16:46:49

Version 2

2019-10-30, 19:05:16

Idiom #213 Case-insensitive string compare

Compare four strings in pair-wise variations. The string comparison can be implemented with an equality test or a containment test, must be case-insensitive and must apply Unicode casefolding.

This idiom task is intended to supplant #133 which suffers from massive quality problems.

Idiom #213 Case-insensitive string compare

Compare four strings in pair-wise variations. The string comparison can be implemented with an equality test or a containment test, must be case-insensitive and must apply Unicode casefolding.

This idiom task is intended to supplant #133 which suffers from massive quality problems.

Code
strings = ['ᾲ στο διάολο', 'ὰι στο διάολο', 'Ὰͅ ΣΤΟ ΔΙΆΟΛΟ', 'ᾺΙ ΣΤΟ ΔΙΆΟΛΟ']

strings.combination(2){|a,b| puts "#{a} equals #{b}: #{a.casecmp?(b)}" }
Doc URL
https://ruby-doc.org/core-2.6/String.html#method-i-casecmp-3F