collections.In
Reports whether a value exists within the given slice or string.
- Syntax
- collections.In SLICE|STRING VALUE
- Returns
- bool
- Alias
- in
{{ $s := slice "a" "b" "c" }}
{{ in $s "b" }} → true{{ $s := "abc" }}
{{ in $s "b" }} → trueThe function compares time.Time values by the moment they represent, regardless of time zone:
{{ $utc := time.AsTime "2023-07-19T17:42:36Z" }}
{{ $tokyo := $utc | time.In "Asia/Tokyo" }}
{{ in (slice $utc) $tokyo }} → true