Skip to content

contains

Description

Returns true if the given substring appears anywhere in a string; otherwise return false. The check is case sensitive. For case-insensitive matching, normalize both values with toLowerCase() or toUpperCase() before calling contains.

Syntax

Like many functions in DataPrime, contains supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.

contains(value: string, substring: string): bool
(value: string).contains(substring: string): bool

Arguments

NameTypeRequiredDescription
valuestringtrueThe full string to search (haystack)
substringstringtrueThe substring to look for within the full string (needle)

Example

Check if an AWS Account ID appears in an ARN

Sometimes only a broader field such as an ARN is available. Use contains to test for the presence of the account ID.

create is_from_account from contains(arn_field, '074157727657')
create is_from_account from arn_field.contains('074157727657')

Output

Both notations produce a field is_from_account that is true if the ARN contains the account ID.