Logo

Programming-Idioms

History of Idiom 213 > diff from v3 to v4

Edit summary for version 4 by Oldboy:
New Python implementation by user [Oldboy]

Version 3

2019-10-30, 19:12:19

Version 4

2019-11-05, 20:36:34

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.

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

for a, b in itertools.combinations(strings, 2):
    print(a, b, a.casefold() == b.casefold())