str_overlap
This crate provides a utility function for finding the overlap between two string slices.
The overlap is here defined as the largest substring contained both at the end of the first string slice and the beginning of the second string slice.
Usage
To use this crate, call the provided overlap function with two string slices in the left and
right positions.
use overlap;
assert_eq!;
Note that the positions of the string slices matter. The overlap found is the largest substring at both the end of the left string slice and the beginning of the right string slice.
Performance
The overlap function has temporal complexity O(n) in the worst case (where no overlap is found),
where n is the length of the first string parameter.
Minimum Supported Rust Version
This crate is guaranteed to compile on stable rustc 1.0.0 and up.
License
This project is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.