extname

Function extname 

Source
pub fn extname(path: &str) -> String
Expand description

Returns the extension of the path, from the last occurrence of the . (period) character to end of string in the last portion of the path. If there is no . in the last portion of the path, or if there are no . characters other than the first character of the basename of path, an empty string is returned.

assert_eq!(&nodejs_path::extname("index.html"), ".html");

assert_eq!(&nodejs_path::extname("index.coffee.md"), ".md");

assert_eq!(&nodejs_path::extname("index."), ".");

assert_eq!(&nodejs_path::extname("index"), "");

assert_eq!(&nodejs_path::extname(".index.md"), ".md");