I had a bug in one of my applications so I was wondering what happens if a filename has more than one dot in them. e.g. "hello.world.txt" Will the extension
method return txt
as I'd expect?
The answer is: yes.
My bug is somewhere else.
examples/extenstion-for-files-with-dot/src/main.rs
use std::path::PathBuf;
fn main() {
let path = PathBuf::from("code.rs");
println!("{:?} {:?}", path, path.extension().unwrap());
let path = PathBuf::from("my-data-1.70.html");
println!("{:?} {:?}", path, path.extension().unwrap());
}
"code.rs" "rs"
"my-data-1.70.html" "html"