Skip to main content

luaur_cli_lib/functions/
get_extension.rs

1pub fn get_extension(path: &str) -> alloc::string::String {
2    match path.rfind(['.', '\\', '/']) {
3        Some(dot_index) => {
4            if path.as_bytes()[dot_index] == b'.' {
5                alloc::string::String::from(&path[dot_index..])
6            } else {
7                alloc::string::String::new()
8            }
9        }
10        None => alloc::string::String::new(),
11    }
12}