Check If a Text String Contains a Particular Substring At the End of the String

To determine if a particular string is contained at the end of a text attribute or text constant, you can use the following syntax with the EndsWith function. Either of these text strings can be text attributes or text constants. The text comparison is case-insensitive.

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

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

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

the person has a government email address if

EndsWith(the person's email address, ".gov")

the person's email address: joshua.jones@example.gov the person has a government email address = true
the person's email address: ava.smith@example.com the person has a government email address = false

the product uses the ascending sort code if

EndsWith(the product code, "-ASC")

the product code: 45126874-ASC the product uses the ascending sort code = true
the product code: 84512321 the product uses the ascending sort code = false