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.
After selecting an operation and clicking "Add Step," we will initialize the variable "stringToSplit" and give it the static value "Hello, World".
After initializing our variable, we will compose the input by choosing the Compose action in the flow.
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.
Clicking Done, as shown in the below figure after clicking Run Flow, will bring up a list of options below the screen.
Output
As we can see, String is converted to Array by using the Split() Function.
Summary
In this article, I discussed how we can Convert the String Value to Array by Split() Function.