clippy_utils::str_utils

Function count_match_start

source
pub fn count_match_start(str1: &str, str2: &str) -> StrCount
Expand description

Returns the number of chars that match from the start

assert_eq!(count_match_start("hello_mouse", "hello_penguin"), StrCount::new(6, 6));
assert_eq!(count_match_start("hello_clippy", "bye_bugs"), StrCount::new(0, 0));
assert_eq!(count_match_start("hello_world", "hello_world"), StrCount::new(11, 11));
assert_eq!(count_match_start("T\u{f6}ffT\u{f6}ff", "T\u{f6}ff"), StrCount::new(4, 5));