Skip to main content

word_prefix

Function word_prefix 

Source
pub fn word_prefix(word: &str, text: &str) -> Option<Match>
Expand description

Matches word (one word of a query, case-insensitive) at the start of a word of text: the whole word or its beginning, never letters scattered over several words. For long text, such as a description, where score would find almost any short word somewhere.

use egui_pop_model::fuzzy;

let m = fuzzy::word_prefix("par", "Reads a paragraph").unwrap();
assert_eq!(m.positions, [8, 9, 10]);
assert!(fuzzy::word_prefix("agr", "Reads a paragraph").is_none());