in.md (718B)
1 --- 2 title: in 3 linktitle: 4 description: Checks if an element is in an array or slice--or a substring in a string---and returns a boolean. 5 date: 2017-02-01 6 publishdate: 2017-02-01 7 lastmod: 2017-02-01 8 categories: [functions] 9 menu: 10 docs: 11 parent: "functions" 12 keywords: [strings] 13 signature: ["in SET ITEM"] 14 workson: [] 15 hugoversion: 16 relatedfuncs: [] 17 deprecated: false 18 aliases: [] 19 --- 20 21 The elements supported are strings, integers and floats, although only float64 will match as expected. 22 23 In addition, `in` can also check if a substring exists in a string. 24 25 ``` 26 {{ if in .Params.tags "Git" }}Follow me on GitHub!{{ end }} 27 ``` 28 29 30 ``` 31 {{ if in "this string contains a substring" "substring" }}Substring found!{{ end }} 32 ```