Purpose
The startsWith task is used to determine whether or not a string begins with another string. The task returns a boolean value of True or False based on whether the string starts with the characters of a specified string.
Potential Use Case
Use this task to check the placement of a variable within a string of characters. You could use startsWith to determine if the string has missing or added characters.
Properties
Input and output parameters are shown below.
| Incoming | Type | Description | 
|---|---|---|
| str | String | Required. The string to be searched. | 
| searchString | String | Required. The characters to be searched for at the start of str. | 
| position | Number | The position in the given string to begin searching for the searchString. | 
| Outgoing | Type | Description | 
|---|---|---|
| result | Boolean | True if the specified characters are found at the beginning of the string; false otherwise. | 
Example
Example 1
- In this IAP example, the - strvariable is statically set as "Hello World".
- The - searchStringto find is "W" and the- positionto begin searching is at character "6". Remember, the location of the first character in a string is always 0, the second character 1, and so on. 
- The - resultof this task returns True; the "W" is located in the number "6" character- position. 
Example 2
- The next IAP example is the same as the first except the space between the words "HelloWorld" has been removed.  
- The - resultreturns False since the "W" is now located in- position"5" due to the removal of the space.