Programming-Idioms

History of Idiom 213 > diff from v2 to v3

Edit summary for version 3 :
[Ruby] added demo link

Version 2

2019-10-30, 19:05:16

Version 3

2019-10-30, 19:12:19

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)}" }
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
Doc URL
https://ruby-doc.org/core-2.6/String.html#method-i-casecmp-3F
Demo URL
https://ideone.com/Ljw1JJ