contains(text, text)
contains(text, text), function
def pure contains(haystack: text, needle: text): boolean
Indicates whether the haystack
contains the needle
.
haystack
: the full textneedle
: the text to be searched in the haystack
Example
haystack = "Hello World!"
show summary "" a1c2 with
contains(haystack, "Hello") as "Contains Hello?" // 'true'
contains(haystack, "Town") as "Contains Town?" // 'false'
Errors
Needle is an empty string.
The needle
cannot be an empty text value.
Remarks
This function is case-sensitive.
Recipes and best practices
When you will use the result of this function several times across the account, it is recommended to define the Boolean in the processing pipeline and then export it.
Also, be careful because this function is case-sensitive. If you have different cases in your data for the same information, it is highly recommended to homogenize the cases in the processing pipeline.
Items.Decription = "Blue Pants"
Items.IsBlueCaseSensitive = contains(Items.Description,"blue") // 'false'
Items.IsBlue = contains(~Items.Description,~"blue") // 'true'
Items.IsBlueUppercased = contains(uppercase(Items.Description),"BLUE") // 'true'