Function voca_rs::chop::slice

source ·
pub fn slice(subject: &str, start: isize, end: isize) -> String
Expand description

Extracts from subject a string from start position up to end position. The character at end position is not included.

Arguments

  • subject - The string to extract from.
  • start - The position to start extraction. 0 means extract from the beginning of the subject. If negative use subject.len() - start.
  • end - The position to end extraction. 0 means extract to the end of the subject. If negative use subject.len() - end.

Example

use voca_rs::*;
chop::slice("miami", 1, 0);
// => "iami"
chop::slice("błąd", -2, 0);
// => "ąd"
chop::slice("florida", 1, 4);
// => "lor"
chop::slice("e\u{0301}", 1, 0); // or 'é'
// => "\u{0301}"
chop::slice("Die Schildkröte fliegt.", 4, -8);
// => "Schildkröte"
use voca_rs::Voca;
"miami"._slice(1, 0);
// => "iami"