midstring 0.1.3

Create a string between two other strings, that is lexicographically halfway between them.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use midstring::mid_string;

fn main() {
    println!("Hello, world!");

    println!("_, i => {}", mid_string("", "i")); // -> e
    println!("_, b => {}", mid_string("", "b")); // -> an
    println!("_, _ => {}", mid_string("", "")); // -> n

    assert_eq!(mid_string("aaa", "aaz"), "aan");

    let left = String::from("abc");
    let right = "abcab".to_string();
    let should_be = String::from("abcaan");
    assert_eq!(mid_string(&left, &right), should_be);

    println!("Goodbye, world!");
}