Skip to main content

path_basename

Function path_basename 

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

Extract the filename (last component) from a /-separated path string.

Returns the entire input when there is no / separator.

§Examples

assert_eq!(gitkraft_core::path_basename("src/main.rs"), "main.rs");
assert_eq!(gitkraft_core::path_basename("hello.txt"), "hello.txt");
assert_eq!(gitkraft_core::path_basename(""), "");