contains_ci(X;L)

Returns a boolean value indicating whether a given string contains any of the substrings in a given list and is case insensitive. (Available as of version 12.33)

Syntax

contains_ci(X;L)

Input

Argument Type Description
X text The string to search for in the items in the list L

A scalar value or the name of a column

L text A space- or comma-separated list of text strings against which to compare X

Return Value

Returns an integer value of 1 if X contains any of the strings in the list L. Otherwise, returns 0.

If X is N/A, the result is 0.

Sample Usage

value list contains_ci(value;list)
'banana' 'abc' 'NAN' 'yz' 1
'banana' 'abc' 'yz' 0

Example

In the "Sales Item Detail" table (pub.demo.retail.item), you can find only those rows whose SKUs contain a "B". To do this, create a computed column and apply the contains_ci(X;L) function to the sku column, where L is the list containing the string 'B'.

<base table="pub.demo.retail.item"/>
<willbe name="example" value="contains_ci(sku;'B')"/>
<colord cols="sku,example"/>

For those values in the sku column that contain "B", the result is 1. Otherwise, the result is 0.

Additional Information

contains_ci(X;L) is identical to contains(X;L) except that it performs case-insensitive (in the English alphabet) comparisons.