pub fn fuzzy_match(target: &str, query: &str) -> Option<usize>
Expand description

Fuzzy match a string against a query string. Returns a score that is higher for a more confident match, or None if the query does not match the target string.

§Examples

let matches = code_fuzzy_match::fuzzy_match("the quick brown fox", "bro fox");
assert!(matches.is_some());
let no_match = code_fuzzy_match::fuzzy_match("the quick brown fox", "cat");
assert!(no_match.is_none());

let high_score = code_fuzzy_match::fuzzy_match("Example string", "example");
let lower_score = code_fuzzy_match::fuzzy_match("Example string", "str");
assert!(high_score.unwrap() > lower_score.unwrap());