What is the correct way how to find a substring if I need to start not from 0?
I have this code:
fn SplitFile(reader: BufReader<File>) {
for line in reader.lines() {
let mut l = line.unwrap();
// l contains "06:31:53.012 index0:2015-01-06 00:00:13.084
...
I need to find third :
and parse the date behind it. Still no idea how to do it, because find
doesn't have any param like begin
- see https://doc.rust-lang.org/std/string/struct.String.html#method.find.
(I know I can use regex. I have it done, but I'd like to compare the performance - whether parsing by hand might the quicker than using regex.)
begin
is an offset, then you'd just slice and then finds[begin..].find(...)
– Widner