I want to determine if some string contains a certain substring while respecting combining characters. To illustrate the problem, consider the following example in Rust:
fn main() {
let a_umlaut = "a\u{0308}"; // "ä"
println!("{}", a_umlaut.starts_with("a")); // true
}
Basically, the above shows that "ä".starts_with("a") is true (note the diaeresis over the first "a"). I do understand the reason for this behavior on a technical level, but I still want the above code to output false, since "ä" and "a" are two different user-perceived characters.
Is there an existing function/create that performs string matching while respecting combining characters?