Check If a Text String Contains a Particular Substring

To determine if a particular string is contained anywhere in a text attribute or text constant, you can use the following syntax with the Contains function.

  • Contains(<text value>, <text substring>)

Either of these text strings can be text attributes or text constants. The text comparison is case-insensitive. Either of these text strings can be text attributes or text constants. The text comparison is case-insensitive. If the text substring itself contains a quote, then use the Quote() function as the text substring.

Examples of the use of the Contains function in rules are given in the following table.

Table 1. Examples of the use of the Contains function
Example rule Inputs Outputs

the system is using U.S. English if

Contains(the system code, "en-US")

the system code: en-US the system is using U.S. English = true
the system code: en-GB the system is using U.S. English = false

the account may be a benefit account if

Contains(the account name, "benefit")

the account name: Special Benefits the account may be a benefit account = true
the account name: Special Fund the account may be a benefit account = false