I looked at the Rust docs for String but I can\'t find a way to extract a substring.
Is there a method like JavaScript\'s substr in Rust? If not, how would you implement
I would suggest you use the crate substring. (And look at its source code if you want to learn how to do this properly.)