path.Ext.md (714B)
1 ---
2 title: path.Ext
3 description: Ext returns the file name extension of a path.
4 date: 2018-11-28
5 publishdate: 2018-11-28
6 lastmod: 2018-11-28
7 categories: [functions]
8 menu:
9 docs:
10 parent: "functions"
11 keywords: [path, ext, extension]
12 signature: ["path.Ext PATH"]
13 workson: []
14 hugoversion: "0.40"
15 relatedfuncs: [path.Base, path.BaseName, path.Clean, path.Dir, path.Join, path.Split]
16 deprecated: false
17 ---
18
19 `path.Ext` returns the file name extension `PATH`.
20
21 The extension is the suffix beginning at the final dot in the final slash-separated element `PATH`;
22 it is empty if there is no dot.
23
24 **Note:** On Windows, `PATH` is converted to slash (`/`) separators.
25
26 ```
27 {{ path.Ext "a/b/c/news.html" }} → ".html"
28 ```