Loading

CONTAINS

lists

The CONTAINS function checks if the element on top of the stack is contained by the list on second position. A boolean is pushed on the stack.

If the parameters are two STRINGs, CONTAINS checks if the second STRING is contained in the first one, leaving a boolean on the stack. This latter usage is available since revision 2.1.0.

CONTAINS is available since version 1.0.0.

See also

Signature

Examples

[ 'foo' 'bar' 'cool' ] 'bar' CONTAINS //true [] 42 CONTAINS //empty list, false 'foobar' 'foo' CONTAINS
[ 'foo' 'bar' 'cool' ] 'mylist' STORE <% $mylist 'bar' CONTAINS SWAP DROP %> // keep only boolean result for the test, drop the list output <% 'bar present in the list' %> IFT