Skip to main content
Community site session details

Community site session details

Session Id : 6Jw5OZoFxDQMQla2DXMD7S
Power Automate - Building Flows
Answered

Split String

Like (0) ShareShare
ReportReport
Posted on 6 Oct 2023 15:07:52 by

I have a string of text that I need to split into "pairs." 

 

DODODODODODODODOUSUSDOUSUSDOUSUSDODOUSUSDOUSUSDODOUSUSDODODODO

 

So for the outcome I want: 

0: DO

1: DO

         and so forth.... 

 

I'm composing the variable, putting it in a string, and then using a select to break it apart. It is splitting it, but it's returning every other result in backwards order (DO = OD), and they are duplicates, meaning I'm not getting the full string broken down, just 50% of it because every entry repeats. 

 

Select From: 
range(0, add(div(length(variables('DailyActivities')), 2), 1))

Map: 
substring(variables('DailyActivities'), mul(item(), 1), 
if(greater(add(mul(item(), 2), 2), length(variables('DailyActivities'))), 
sub(length(variables('DailyActivities')), mul(item(), 2)), 2))

Response: 
[
 "DO",
 "OD",
 "DO",
 "OD",
 "DO",
 "OD",
 "DO",
 "OD",
 "DO",
 "OD",
 "DO",
 "OD",
 "DO",
 "OD",
 "DO",
 "OU",
 "US",
 "SU",
 "US",
 "SD",
 "DO",
 "OU",
 "US",
 "SU",
 "US",
 "SD",
 "DO",
 "OU",
 "US",
 "SU",
 "US",
 ""
]

 

Help please! 

 

StringSplit1.JPGStringSplit2.JPG

  • Rex2025 Profile Picture
    on 06 Oct 2023 at 15:56:58
    Re: Split String

    Phenomenal! Thank you so much! Chunk worked GREAT!

  • VictorIvanidze Profile Picture
    12,554 on 06 Oct 2023 at 15:51:40
    Re: Split String

    Use the chunk function: https://zeitgeistcode.com/power-automate-chunk-function/

  • Verified answer
    Nived_Nambiar Profile Picture
    17,978 Super User 2025 Season 2 on 06 Oct 2023 at 15:48:56
    Re: Split String

    Hi @Rex2025 

     

    Use chunks function in power automate to split a array/string into equal length 

    see below

    Nived_Nambiar_0-1696607243870.png

     

    Here i am using chunk to split the string into length of each split as 2

     

    See below result of above expression :

    Nived_Nambiar_1-1696607327582.png

     

    Hope it helps !

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

  • Rex2025 Profile Picture
    on 06 Oct 2023 at 15:31:06
    Re: Split String

    Thank you. This looks fantastic but I'll have to keep using the provided options at this time as I'm not in a position to spend any money. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2