# Power Automate Length Function Explained The Power Automate Length function helps you to check the length of a string or to check the length of an array.

In this article, I’ll introduce you to the length function and will provide a step-by-step guide on how to use the function in a Microsoft flow.

## Power Automate Length Function

The Power Automate length function returns the length of a string (number of characters) or the length of an array (number of elements for an array).

### Syntax

``````length('<collection>')
length([<collection>])``````

#### Input parameters

• collection (mandatory):

#### Return value

• An Integer that represents the number of characters in a string for a given string or the number of elements for an array.

### Power Automate Length Expression Examples

Here are some examples on how to use length expression in Power Automate.

#### Power Automate expression length of string

``````length('abc')
=> 3``````

#### Power Automate expression length of array

``````length(createArray('a', 'b', 'c'))
=> 3``````

## How To Use The Length Function In Power Automate

Let’s take a look on how to get the length of a string and how to get the length of an array in Power Automate in Microsoft flow.

1. #### Create a new flow Create a new flow

2. #### Create a string variable New string variable

3. #### Compose a Power Automate length expression ‘length(variables(‘myString’))’ Power Automate length string expression

4. #### Create an array variable New array variable

5. #### Compose a Power Automate length expression ‘length(variables(‘myArray’))’ Power Automate length array expression

6. #### Do a test run and check the result for the string Length of Luke is 4 (4 characters)

7. #### Check the result for the array Length of array is 6 (6 items)

## More Examples

### Get the length of an integer

The Power Automate length function does not work with numbers. To get the length of a number, you need to convert it to a string. Use the string function to do the conversion and use length on the resulting string.

``````length(string(1234))
=> 4``````