yesorno

Useful for validating answers of a CLI prompt.

Usage

```rs extern crate yesorno;

fn main() {

let isyes = yesorno::isyes("yes"); println!("Is Yes ? : {}", is_yes);

let isno = yesorno::isno("no"); println!("Is No ? : {}", is_no);

let islenientyes = yesorno::islenientyes("yrs"); println!("Is lenient Yes ? : {}", islenientyes);

let islenientno = yesorno::islenientno("ni"); println!("Is lenient No ? : {}", islenientno);

let isyesfalse = yesorno::isyes("no"); println!("Is Yes ? : {}", isyes_false); } ```

What is lenient ?

Use key distance based score to leniently accept typos of yes and no. This is slightly simple the original algorithm solved here in perl

Keyboard distance for fuzzy string matching. Keyboard distance is a measure of the physical distance between two keys on a keyboard. For example, 'g' has a distance of 1 from the keys 'r', 't', 'y', 'f', 'h', 'v', 'b', and 'n'. Immediate diagonals (like ''r, 'y', 'v', and 'n') are considered to have a distance of 0.75 and others are considered 0.25.

Similar Question