web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How i can split a stin...
Power Automate
Suggested Answer

How i can split a sting to generate Array without empty string

(0) ShareShare
ReportReport
Posted on by 1,849 Season of Giving Solutions 2025
I have a Child Flow which accept names in a semi-collon separate string, here are examples of the string:-
 
;test
 
test;test2
 
test;;test2
 
test
 
 
now i want to generate an array but i do not want the array to have empty strings .. can i write a single formula to do this? i do not want to do a separate action to filter the Array. i am searching to do this in a single formula..Thanks
Categories:
I have the same question (0)
  • lbendlin Profile Picture
    8,649 Super User 2026 Season 1 on at
    Are these all the possible examples? :-)
     
    split(
      if(
        startswith(replace(outputs('String'),';;',';'),';'),
        substring(replace(outputs('String'),';;',';'),1),
        if(endswith(replace(outputs('String'),';;',';'),';'),
          substring(replace(outputs('String'),';;',';'),0,length(replace(outputs('String'),';;',';'))-1),
                replace(outputs('String'),';;',';')
        )
        )
    ,';')
  • johnjohnPter Profile Picture
    1,849 Season of Giving Solutions 2025 on at
     
    Thanks for the formula, but i got that it is not valid when i add it to the compose action. any advice? As i know that SubString() should contain 3 parameters, but your first SubString() contains only 2 parameters

    for the combination, i might have this string format:-

    ;p;;p6;

    where i only need p & p6..
    Thanks
  • Suggested answer
    Ellis Karim Profile Picture
    11,994 Super User 2026 Season 1 on at
     
    Would this expression work for you? I've updated the expression based on your sample data.

     

     
    json(replace(replace(string(split(variables('varString'),';')),'"",',''), '""]',']'))
     

     
    Ellis
     
  • lbendlin Profile Picture
    8,649 Super User 2026 Season 1 on at
    The third parameter of substring is optional if you want to get the whole rest of the string.

    I forgot that you cannot subtract numbers easily in Power Automate.

    split(
      substring(replace(variables('String'),';;',';'),
        if(startswith(replace(variables('String'),';;',';'),';'),1,0),
        sub(length(replace(variables('String'),';;',';')),
          add(if(startswith(replace(variables('String'),';;',';'),';'),1,0),
              if(endswith(replace(variables('String'),';;',';'),';'),1,0)
          )
        )
      ) 
    ,';')


  • johnjohnPter Profile Picture
    1,849 Season of Giving Solutions 2025 on at
     
    Thanks , but i am getting invalid error when i tried to add your formula
  • lbendlin Profile Picture
    8,649 Super User 2026 Season 1 on at
    I updated my response.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard