CONTAINS


1 COntains(haystack,+ , needle)

If the haystack string contains one or more of the needle strings, CONTAINS returns 1. Otherwise, CONTAINS returns 0.

CONTAINS is case-sensitive: it only returns 1 if the haystack contains a string with the same mix of uppercase and lowercase as a needle.

Example 1

If the current input record contains Michael, Mick or Mike in the first ten columns, print the record.
If co(fld(1,10),'Michael','Mick','Mike') Then print(inrec, 'CHAR')

Example 2

If the current input record contains USA, Australia or England, drop the record from processing.
If contains(inrec,'USA','Australia','England') Then exit 'DROP'

Related tasks