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 to use trim for re...
Power Automate
Answered

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,136 Super User 2026 Season 1 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,136 Super User 2026 Season 1 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

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 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard