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!
Phenomenal! Thank you so much! Chunk worked GREAT!
Hi @Rex2025
Use chunks function in power automate to split a array/string into equal length
see below
Here i am using chunk to split the string into length of each split as 2
See below result of above expression :
Hope it helps !
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! 🙌
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.
Tomac
986
Moderator
stampcoin
699
Super User 2025 Season 2
Riyaz_riz11
577
Super User 2025 Season 2