API Reference › Path › Path.ext
method

Path.ext

Path.ext(p) -> string

Returns the extension of the final component, including the leading dot (e.g. ".json"), or the empty string when there is none. A leading-dot name (a dotfile like .gitignore) has no extension.

Parameters

pthe path

Example

program Ext {
  entry {
    if Path.ext("hero.png") == ".png" { print(1) }
  }
}
← All symbols