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

# length (string)

> Use the length (string) task to count the number of characters in a string.

The `length` (string) task counts the number of characters in a given string and returns the count.

The `length` of an empty string is `0`.

## Potential use case

This task specifies the maximum number of characters allowed for a string property. For example, to verify that a user provided exactly three characters (such as `ATL`, `HNL`, or `LHR`) for an airport code on an entry form, use `length` (string) to get the character count in the user-provided string. Additional logic applied elsewhere in the workflow can then compare that count to the acceptable value.

## Properties

| Incoming | Type   | Description                                                        |
| :------- | :----- | :----------------------------------------------------------------- |
| `str`    | String | Required. The string to get the length of using a character count. |

| Outgoing | Type   | Description                                                                                                                               |
| :------- | :----- | :---------------------------------------------------------------------------------------------------------------------------------------- |
| `length` | Number | The number of characters counted in the `str` variable. The count includes spaces, alphanumeric values, and any other special characters. |

## Example

In this example:

* The `str` variable is statically set to `12 Dollars And 43 Cents`.
* The outgoing `length` value is `23`, representing the total number of characters counted.

![](/_fern-img/220f68c7c860d91dda8f5b903bd6cf7cbe96eb22dd4af501866a8050beeb52f0.webp)