pub fn get_file_name_without_extension(path: &str) -> Option<String>
Expand description
Extract the file name without its extension
This function extracts just the file name portion of a path, excluding both the directory path and the file extension.
§Arguments
path
- The file path to extract the name from
§Returns
Some(String)
containing the file name without extension if present, None
otherwise.
§Examples
use tree_parser::get_file_name_without_extension;
assert_eq!(get_file_name_without_extension("test.py"), Some("test".to_string()));
assert_eq!(get_file_name_without_extension("path/to/file.rs"), Some("file".to_string()));
assert_eq!(get_file_name_without_extension("no_extension"), Some("no_extension".to_string()));