Function as_substr

Source
pub(crate) fn as_substr<'a>(
    original: &'a str,
    suggestion: &'a str,
) -> Option<(usize, &'a str, usize)>
Expand description

Given an original string like AACC, and a suggestion like AABBCC, try to detect the case where a substring of the suggestion is “sandwiched” in the original, like BB is. Return the length of the prefix, the “trimmed” suggestion, and the length of the suffix.