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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to use trim for re...
Power Automate
Unanswered

How to use trim for removing spaces between two or multiple words

(0) ShareShare
ReportReport
Posted on by 4

Hello This is my first interaction with this community , Hello dev's I'm have a issue where I want to remove each kind of spaces in between words from beginning and from end 

 

how can I do that i have used trim text but only allows beginning and end trim not between 

 

 

I have the same question (0)
  • v-peijunz-msft Profile Picture
    Microsoft Employee on at

    Hi @sagarraval 

     

    The function trim only removes leading and trailing whitespace from a string.

    To remove the space between words, you could use replace function:

    Reference guide for expression functions - Azure Logic Apps | Microsoft Learn

     

    Here is a simple example for your reference:

    replace(outputs('Compose'),' ','')

    vpeijunzmsft_1-1682328142376.png

     

    Result:

    vpeijunzmsft_0-1682328103937.png

     

    Hope it helps.

     

    Best regards,

    Sylvia

     

  • Verified answer
    Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    Hi @sagarraval 

     

    I think you are trying to do this in power automate desktop, if yes then you can try this :

     

     

     

    Nived_Nambiar_0-1682328312825.png

     

    Here i have string stored in strA variable, Now used a replace to replace all spaces with ''

    Nived_Nambiar_1-1682328358182.png

     

    Output got

    Nived_Nambiar_2-1682328372349.png

     

     

     

    Hope it helps

     

    Mark it as solution if it resolves your query 🙂

     

  • sagarraval Profile Picture
    4 on at

    Thanks a lot , it worked , but can you tell me how can i get the same output without regex , for eg in oher languages i do it like replace(var," ","")

  • Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    Hi @sagarraval 

     

    use replace like this without regex

     

    Nived_Nambiar_0-1682337672543.png

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard