Crate str_overlap[][src]

This crate provides methods for finding the overlap between two string slices.

An overlap is here defined as the largest substring contained both at the end of one string slice and the beginning of another string slice.

The implementation is provided through the Overlap trait, which is implemented on str. This allows the user to simply pull the trait into scope and use its methods:

use str_overlap::Overlap;

assert_eq!("bcd".overlap_start("abc"), "bc");
assert_eq!("abc".overlap_end("bcd"), "bc");

The trait provides two methods: overlap_start and overlap_end, which find the overlap at the beginning and end of the first value respectively. The reason for these two methods is to allow the user to specify ownership of the resulting subvalue, regardless of its overlap position.



Provides methods for finding overlaps between values.