- 23 May 2023
-
DarkLight
-
PDF
includes (string)
- Updated on 23 May 2023
-
DarkLight
-
PDF
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.
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 as12 Dollars And 43 Cents
. -
The
searchString
variable to search for isCents
. -
The
position
number to begin searching within the string has been statically coded as19
. -
The
result
will befalse
, which means no instance of thesearchString
occurs starting from position 18 of thestr
variable (starting at position 19, thestr
value reads "ents").
Example 2
In this IAP example:
-
The
str
variable has been statically coded as12 Dollars And 43 Cents
. -
The
searchString
variable to search for iscents
. -
The
position
number to begin searching within the string has been statically coded as18
. -
The
result
will befalse
because thesearchString
is case sensitive ("Cents" is not equal to "cents").
Example 3
In this IAP example:
-
The
str
variable has been statically coded as12 Dollars And 43 Cents
. -
The
searchString
variable to search for isCents
. -
The
position
variable has been left blank (thereby defaulting to0
). -
The
result
will betrue
because thesearchString
("Cents") does appear within thestr
variable.