count_match_end in clippy_utils::str_utils - Rust
Description: Returns the number of chars and bytes that match from the end

Skip to main content

## count_match_end

# Function count_match_end

Source

    pub fn count_match_end(str1: &str, str2: &str) -> StrCount

Expand description

Returns the number of chars and bytes that match from the end

    assert_eq!(count_match_end("hello_cat", "bye_cat"), StrCount::new(4, 4));
    assert_eq!(count_match_end("if_item_thing", "enum_value"), StrCount::new(0, 0));
    assert_eq!(count_match_end("Clippy", "Clippy"), StrCount::new(6, 6));
    assert_eq!(count_match_end("MyT\u{f6}ff", "YourT\u{f6}ff"), StrCount::new(4, 5));