Trait stringslice::StringSlice [−][src]
Provides the slice
, try_slice
, substring
, and try_substring
methods.
Required methods
fn slice(&self, range: impl RangeBounds<usize>) -> &str
[src]
Returns a string slice for the given range of characters
This method will panic if the range is invalid, for example if the beginning is greater than the end.
Examples
use stringslice::StringSlice; assert_eq!("Ùníc😎de".slice(4..5), "😎");
fn try_slice(&self, range: impl RangeBounds<usize>) -> Option<&str>
[src]
Returns an Option
containing string slice for the given range of characters
This method will return None
if the range is invalid,
for example if the beginning is greater than the end.
Examples
use stringslice::StringSlice; assert_eq!("Ùníc😎de".try_slice(4..5), Some("😎"));
fn substring(&self, begin: usize, end: usize) -> &str
[src]
Returns a string slice between the given beginning and end characters
This method will panic if the parameters are invalid, for example if the beginning is greater than the end.
Examples
use stringslice::StringSlice; assert_eq!("Ùníc😎de".substring(4, 5), "😎");