Task References

On this page:



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.


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 1

  • In this IAP example, the str variable is statically set as "Hello World".

  • The searchString to find is "W" and the position to 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 result of 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 result returns False since the "W" is now located in position "5" due to the removal of the space.