yq/pkg/yqlib/doc/operators/headers/contains.md
2022-11-01 09:29:05 +11:00

612 B

Contains

This returns true if the context contains the passed in parameter, and false otherwise. For arrays, this will return true if the passed in array is contained within the array. For strings, it will return true if the string is a substring.

{% hint style="warning" %}

Note that, just like jq, when checking if an array of strings contains another, this will use contains and not equals to check each string. This means an array like contains(["cat"]) will return true for an array ["cats"].

See the "Array has a subset array" example below on how to check for a subset.

{% endhint %}