[−][src]Trait substring::Substring
Provides a substring
method.
The substring
method obtains a string slice of characters within the range specified by
start_index
and end_index
.
Required methods
fn substring(&self, start_index: usize, end_index: usize) -> &str
Obtains a string slice containing the characters within the range specified by
start_index
and end_index
.
The range specified is a character range, not a byte range.
Implementations on Foreign Types
impl Substring for str
[src]
Provides a substring
method for &str
.
fn substring(&self, start_index: usize, end_index: usize) -> &str
[src]
Obtain a slice of the characters within the range of start_index
and end_index
.
As this is by character index, rather than byte index, the temporal complexity of finding a
substring is O(n)
.
Example:
use substring::Substring; assert_eq!("foobar".substring(2,5), "oba");