std-method
str::rfind
Search from the end and return the byte offset of the last matching start. Expected stdout (not executed): Some(3) Common mistake: Treating a byte offset as a scalar index.
Formal Syntax & Structure
rust syntaxrust
text.rfind(pattern) -> Option<usize>Working Example
Example Snippetrust
fn main() { println!("{:?}", "ش-ش".rfind('ش'));}