Skip to main content

substr

Function substr 

Source
pub fn substr(text: &str, offset: usize, len: usize) -> &str
Expand description

Perl’s substr($text, $offset, $len) for a non-negative offset and length: it counts CHARACTERS, so a byte slice of document text (year[2..4] on 1–250, 2023, witnesses 2308.14725, 2607.14650) panics where Perl reads on. Past the end it is empty, as Perl’s in-range substr is.