Logo

Programming-Idioms

History of Idiom 213 > diff from v6 to v7

Edit summary for version 7 by Zso:
New Rust implementation by user [Zso]

Version 6

2020-09-24, 16:41:58

Version 7

2020-11-09, 21:07:57

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
use itertools::Itertools;
Code
for x in strings
    .iter()
    .combinations(2)
    .filter(|x| x[0].to_lowercase() == x[1].to_lowercase())
{
    println!("{:?} == {:?}", x[0], x[1])
}
Doc URL
https://doc.rust-lang.org/std/string/struct.String.html#method.to_lowercase
Demo URL
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=0836b597a3225a93ef8a1cad2bb502a9