includes (string)
  • 23 May 2023
  • Dark
    Light
  • PDF

includes (string)

  • Dark
    Light
  • PDF

Article summary

includes (string) Task Purpose

The string includes task searches an input variable for a predefined value and returns 'true' if the value is found, or 'false' if the value is not found.

Note:

The string includes task is case sensitive.

Potential Use Case

You could use this task if you need to scan an email list for the word 'unsubscribe' and execute a process to remove that email address from a database.

Properties

Incoming Type Description
str String Required. The string to search.
searchString String Required. The string to search for within str. This is case sensitive.
position Number Optional. The character position within str to begin the search. The character position count begins at 0 (zero), which is the default. This parameter is useful if the searchString is known to appear more than once in the str, and you only need to verify the existence of the second or third instance, etc.


Outgoing Type Description
result Boolean Returns true if the searchString is found anywhere within the given string; returns false if not.

Example 1

In this IAP example:

  • The str variable has been statically coded as 12 Dollars And 43 Cents.

  • The searchString variable to search for is Cents.

  • The position number to begin searching within the string has been statically coded as 19.

  • The result will be false, which means no instance of the searchString occurs starting from position 18 of the str variable (starting at position 19, the str value reads "ents").

    stringInclude01

Example 2

In this IAP example:

  • The str variable has been statically coded as 12 Dollars And 43 Cents.

  • The searchString variable to search for is cents.

  • The position number to begin searching within the string has been statically coded as 18.

  • The result will be false because the searchString is case sensitive ("Cents" is not equal to "cents").

    stringIncludes02

Example 3

In this IAP example:

  • The str variable has been statically coded as 12 Dollars And 43 Cents.

  • The searchString variable to search for is Cents.

  • The position variable has been left blank (thereby defaulting to 0).

  • The result will be true because the searchString ("Cents") does appear within the str variable.

    stringIncludes03


Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.