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
fn rep(&self, n: usize) -> String
Repeat the string n
times.
Requires feature="std"
fn append(&self, s: &str) -> String
Requires feature="std"
fn prefixes(&self) -> Prefixes
All non-empty prefixes
fn suffixes(&self) -> Suffixes
All non-empty suffixes
fn substrings(&self) -> Substrings
Produce all non-empty substrings
fn is_acceptable_index(&self, index: usize) -> bool
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
impl StrExt for str