length (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

IncomingTypeDescription
strStringRequired. The string to get the length of using a character count.
OutgoingTypeDescription
lengthNumberThe 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.
length task output showing a count of 23 characters for the input string