Contains [CONTAINS]

Checks whether a specified string is contained within a text.

Returns True if the string is present

Returns False if the string is not present

Case sensitive by default. (Otherwise, enter False for the CaseSensitive argument.)

Syntax

CONTAINS (“FindText”, “WithinText”, [CaseSensitive])

Note: The required separator (comma or semi-colon) automatically corresponds to your computer’s location settings.

Data Types of the Arguments

All Texts: String

Case sensitive (optional) True/False

Data Type of the Result

True/False

Example

Based on the text of a manufacturers catalog: Display the appropriate length unit (either cm or inches) for a chair’s Height value.

Here, the catalog text (a string) is a predefined property value called HeightInString.

This string is transformed into a number (using STRTONUM).

It is then multiplied by the appropriate length unit (either cm or inches, depending on whether the string contains the “cm” tag: this is determined by the CONTAINS function).

The result is a Length-type property.

Expression

STRTONUM (HeightInString) * IF (CONTAINS (“cm”, HeightInString), 1 cm, 1 in)

Result

For a HeightInString property string value of “150 cm”, displays a length value of “150 cm”.

  • Was this Helpful ?
  • YesNo