Trait odds::string::StrExt [] [src]

pub trait StrExt {
    fn rep(&self, n: usize) -> String;
    fn append(&self, s: &str) -> String;
    fn prefixes(&self) -> Prefixes;
    fn suffixes(&self) -> Suffixes;
    fn substrings(&self) -> Substrings;
    fn is_acceptable_index(&self, index: usize) -> bool;
}

Extra methods for str

Required Methods

Repeat the string n times.

Requires feature="std"

Requires feature="std"

All non-empty prefixes

All non-empty suffixes

Produce all non-empty substrings

Return true if index is acceptable for slicing the string.

Acceptable indices are byte offsets from the start of the string that mark the start of an encoded utf-8 sequence, or an index equal to self.len().

Return false if the index is out of bounds.

For example the string "Abcαβγ" has length is 9 and the acceptable indices are 0, 1, 2, 3, 5, 7, and 9.

use odds::string::StrExt;
for &ix in &[0, 1, 2, 3, 5, 7, 9] {
    assert!("Abcαβγ".is_acceptable_index(ix));
}

Implementors