mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-22 21:42:50 +02:00
Merge commit 'e509cac533600cf4fa8382c9cdab78ddd82db688'
This commit is contained in:
38
docs/content/en/functions/collections/In.md
Normal file
38
docs/content/en/functions/collections/In.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
title: collections.In
|
||||
linkTitle: in
|
||||
description: Reports whether an element is in an array or slice, or if a substring is in a string.
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: functions
|
||||
function:
|
||||
aliases: [in]
|
||||
returnType: bool
|
||||
signatures: [collections.In SET ITEM]
|
||||
relatedFunctions:
|
||||
- collections.Slice
|
||||
aliases: [/functions/in]
|
||||
---
|
||||
|
||||
|
||||
|
||||
```go-html-template
|
||||
{{ $s := slice "a" "b" "c" }}
|
||||
{{ in $s "b" }} → true
|
||||
```
|
||||
|
||||
```go-html-template
|
||||
{{ $s := slice 1 2 3 }}
|
||||
{{ in $s 2 }} → true
|
||||
```
|
||||
|
||||
```go-html-template
|
||||
{{ $s := slice 1.11 2.22 3.33 }}
|
||||
{{ in $s 2.22 }} → true
|
||||
```
|
||||
|
||||
```go-html-template
|
||||
{{ $s := "abc" }}
|
||||
{{ in $s "b" }} → true
|
||||
```
|
Reference in New Issue
Block a user