> 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.

# padStart

> Use the padStart task to pad a string with a specified string at the start until it reaches a given length.

The `padStart` task pads a current string with a specified string (repeated, if needed) so that the resulting string reaches a given length. The padding is applied at the start of the current string.

## Potential use case

Suppose you have a dataset of a known length and you would like to repeat that dataset at the beginning of the current dataset. You could use the `padStart` task to specify the numeric length and variables needed to pad the start of the original dataset.

## Properties

| Incoming       | Type   | Description                                                                                                                                             |
| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `str`          | String | Required. The string to pad.                                                                                                                            |
| `targetLength` | Number | The length of the resulting string after it has been padded. If the value is less than the original `str` length, then the original string is returned. |
| `padString`    | String | Required. The specified string to pad to the start of the original string.                                                                              |

| Outgoing       | Type   | Description                                                                                   |
| -------------- | ------ | --------------------------------------------------------------------------------------------- |
| `paddedString` | String | A string that has been padded at the beginning with a specified string to the desired length. |

## Example

In this example:

* The `str` variable is "Hello World" and the current length of the string is 11 characters, including the space.
* The new `targetLength` has been set to 14, and the `padString` variable of "123" is applied at the start of the current string so that it reaches the desired `targetLength` of 14 characters.

![](/_fern-img/4582acb02366eb856800f7b78bcd4ea2fa00020d798d92f1f47996f8616d7955.webp)

The expected result is "123Hello World". Notice that the beginning of the word string for "Hello World" has been padded with "123" in order to fulfill the specified `targetLength`.

![](/_fern-img/6bf4e4e4440f767f8cf73c885d1f43c068297ccafb30d5212d14808bb1ec3ca0.webp)