- 23 May 2023
-
DarkLight
-
PDF
length (string)
- Updated on 23 May 2023
-
DarkLight
-
PDF
length (string) Task Purpose
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 (zero).
Potential Use Case
This task can be used to specify the maximum number of characters allowed for a string property. Let's say you need to verify that a user provided exactly 3 characters (e.g., "ATL", "HNL", "LHR") for an airport code on an entry form. Using length (string) would provide the character count in the user provided string, with additional logic applied elsewhere in the workflow to compare that count to the acceptable character count value in the database.
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, alpha-numeric values, and any other special characters. |
Example
In this IAP example:
-
The
str
variable has been statically coded as12 Dollars And 43 Cents
. -
The outgoing
length
value will be23
, which represents the number of characters that were counted.