strings.HasSuffix.md (552B)
1 ---
2 title: strings.HasSuffix
3 description: Determine whether or not a given string ends with the provided trailing suffix string.
4 date: 2019-08-13
5 publishdate: 2019-08-13
6 lastmod: 2019-08-13
7 categories: [functions]
8 menu:
9 docs:
10 parent: "functions"
11 keywords: [strings]
12 signature: ["strings.HasSuffix STRING SUFFIX"]
13 workson: []
14 hugoversion:
15 relatedfuncs: [hasPrefix]
16 deprecated: false
17 aliases: []
18 ---
19
20 {{ $pdfPath := "/path/to/some.pdf" }}
21 {{ strings.HasSuffix $pdfPath "pdf" }} → true
22 {{ strings.HasSuffix $pdfPath "txt" }} → false