Function voca_rs::chop::substring

source ·
pub fn substring(subject: &str, start: usize, end: usize) -> 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.
  • end - The position to end extraction. 0 means extract to the end of the subject.

Example

use voca_rs::*;
chop::substring("beach", 1, 0);
// => "each"
chop::substring("błąd", 2, 4);
// => "ąd"
chop::substring("e\u{0301}", 1, 0); // or 'é'
// => "\u{0301}"
use voca_rs::Voca;
"beach"._substring(1, 0);
// => "each"