[go: up one dir, main page]

odds 0.4.0

Odds and ends — collection miscellania. Extra functionality for slices (`.find()`, `RevSlice`), strings and other things. Things in odds may move to more appropriate crates if we find them.
Documentation

extern crate odds;
extern crate itertools;

use odds::string::StrExt;

#[test]
fn prefixes() {
    itertools::assert_equal(
        "".prefixes(),
        Vec::<&str>::new());
    itertools::assert_equal(
        "x".prefixes(),
        vec!["x"]);
    itertools::assert_equal(
        "abc".prefixes(),
        vec!["a", "ab", "abc"]);
}

#[test]
fn substrings() {
    itertools::assert_equal(
        "αβγ".substrings(),
        vec!["α", "αβ", "β", "αβγ", "βγ", "γ"]);
}