Check if a text string contains a given substring

Check if a text string contains a given substring

You can check whether a text string contains a particular substring, at the start, end or anywhere within the text string. Either of these text strings can be text variables or text constants. The text comparison is case-insensitive.

What do you want to do?

Check if a text string contains a particular substring

Check if a text string contains a particular substring at the start of the string

Check if a text string contains a particular substring at the end of the string

Check if a text string contains a particular substring

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

For example:

the system is using US English if

the system code contains "en-US"

Check if a text string contains a particular substring at the start of the string

To determine if a particular string is contained at the start of a text variable or text constant, you can use the following syntax with the StartsWith function:

For example:

the record was created before 2000 if

the record identification code starts with "19"

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 variable or text constant, you can use the following syntax with the EndsWith function:

For example:

the person has a government email address if

the person's email address ends with ".gov"