Remove the new line from read_line

Not -2, but -1 instead and you can also omit the 0, something like this.

let foo = "abc\n";
println!("{}", &foo[..foo.len()-1]);

but I would recommend .trim() (or .trim_right() if you want).

2 Likes