Sha256: 6e25584ae6072859f2d60ac8ce0ef789c11d969a7e864c07635270bb644a99e6

Contents?: true

Size: 314 Bytes

Versions: 4

Compression:

Stored size: 314 Bytes

Contents

use path_parsing::extract_last_path_segment;

pub fn extname(pth: &str) -> &str {
  let name = extract_last_path_segment(pth);

  if let Some(dot_i) = name.rfind('.') {
    if dot_i > 0 && dot_i < name.len() - 1 && name[..dot_i].chars().rev().next().unwrap() != '.' {
      return &name[dot_i..]
    }
  }

  ""
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
faster_path-0.2.6 src/extname.rs
faster_path-0.2.5 src/extname.rs
faster_path-0.2.4 src/extname.rs
faster_path-0.2.3 src/extname.rs