Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Replace character in string with new line

Hi everybody,

In my flow, I have an array that contains a string with multiple values. The values in the string are separated by the following character "<>".  The array looks like this:

     "Values": "Test 1<>Test 2<>Test 3<>Test 4"

I want to replace the character with a new line. So I get this result:

Test 1
Test 2
Test 3
Test 4

Hope someone can help 🙂 


Dual Super User
Dual Super User

You can easily replace the characters when you use the string.  But you I don't think you can replace them in the context of the array itself.  To replace them when you use the string simply initialize a variable and add a Carriage return to the variable.  Then use that variable in a Replace() function on the string.



If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Super User
Super User

Like this:


Expression is:

replace(outputs('Compose'), '<>', decodeUriComponent('%0A'))
Super User
Super User

Hello @seryil ,

loop through the array with 'Apply to each' to process all the items one by one. Since it's an object, not a simple array, you can't use 'Current item' dynamic content directly, you must extend it by the ?['Values'] to access only the values.

For the 'new line' you can then use the decodeUriComponent('%0A') expression that will take the Uri value for a new line (%0A) and convert it into a new line to use in your string.



If you need all the values from the array in a single variable, you can initialize a string variable and append the replace(...) expression into that variable.

[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Helpful resources

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (1,262)