> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# startsWith

> Use the startsWith task to determine whether a string begins with a specified set of characters.

The `startsWith` task determines whether a string begins with another string and returns a boolean result of `true` or `false`.

## Potential use case

Use this task to check the placement of a variable within a string of characters, or to determine if the string has missing or added characters.

## Properties

| Incoming       | Type   | Description                                                                                                         |
| :------------- | :----- | :------------------------------------------------------------------------------------------------------------------ |
| `str`          | String | Required. The string to search.                                                                                     |
| `searchString` | String | Required. The characters to search for at the start of `str`.                                                       |
| `position`     | Number | Optional. The position in the string to begin searching for `searchString`. The first character is at position `0`. |

| Outgoing | Type    | Description                                                                                          |
| :------- | :------ | :--------------------------------------------------------------------------------------------------- |
| `result` | Boolean | `true` if the specified characters are found at the given position in the string; `false` otherwise. |

## Example 1

In this example:

* The `str` is statically set to `"Hello World"`.
* The `searchString` is `"W"` and the `position` is `6`.
* The `result` returns `true` — the letter `"W"` is located at position six.

![](/_fern-img/83a32e44846741e3c076ada562c63e964c76df0025e782c6ba1106f93efb283a.webp)![](/_fern-img/7030691db9bb485d7825238078a7d031ae8e2631d2354a5305dba20e1c105f50.webp)

## Example 2

This example is the same as Example 1, except the space between the words has been removed, making the string `"HelloWorld"`.

![](/_fern-img/ca93f9a3ac51b22c20ec12b02b116a44fd41e970d92ea1cafa67086a29e70c65.webp)

The `result` returns `false` — removing the space shifted `"W"` to position five, so it is no longer at position six.

![](/_fern-img/718f404677187216cb02306253c0b20a8fe9815573503269d35929074b684454.webp)