How to use Power Automate to split a string into an array

Introduction

We frequently need to split a string value while working on a Power Automate flow. To achieve this, we use the Power Automate split() function.

A string value can be split into a list of substrings using the split() function. To separate slashes, commas, spaces, and other special delimiters, we use the split() function.

To separate the text string, use a delimited or separator. An integer or a string of characters that match can be used as the separator.

Syntax of Split()

split( text: string, separator: string)

Let's begin by learning how to use Power Automate to split a string value by a comma.

In this example, a Power Automate flow that is manually triggered will be created.

Build cloud flow

After selecting an operation and clicking "Add Step," we will initialize the variable "stringToSplit" and give it the static value "Hello, World".

Initalize Value Split string into array

Initalize Variable Split string into array

After initializing our variable, we will compose the input by choosing the Compose action in the flow.

Compose

Dynamic content

Here, we are creating the input by passing the variable " stringToSplit" and separator as "," to the split() function.

Below is the expression:

split(variables(stringToSplit),',')

As shown below, save the flow and manually test the flow.

Split string into array

Test the flow

Clicking Done, as shown in the below figure after clicking Run Flow, will bring up a list of options below the screen.

Run flow

Output

As we can see, String is converted to Array by using the Split() Function.

Outputs

Summary

In this article, I discussed how we can Convert the String Value to Array by Split() Function.


Similar Articles