Function get_file_stem

Source
pub fn get_file_stem<P: AsRef<Path>>(path: P) -> String
Expand description

Get the file stem (i.e. file name without its extension).

§Arguments

  • path - The path to the file (can be a &str, String, Path, or PathBuf).

§Returns

The file stem (i.e. the file name without its extension).

§Panics

If the file stem cannot be determined.

§Example

use file_io::get_file_stem;

let file_stem = get_file_stem("/some/path/to/file.txt");
assert_eq!(file_stem, "file");