Skip to main content

Notifications

Community site session details

Community site session details

Session Id : dK4edtMIIHNJPldYun7IAy
Power Automate - General Discussion
Answered

Remove all spaces from string

Like (1) ShareShare
ReportReport
Posted on 17 Dec 2020 02:19:39 by 248

Hi, does anyone know how to remove all spaces from a string, thus concatenating it?

 

Example: "this is my string"  when all spaces are removed it looks like "thisismystring"

  • EERC Profile Picture
    7 on 16 Aug 2023 at 14:05:29
    Re: Remove all spaces from string

    @oprandij wrote:

    ...What am I doing wrong?


    Don't try to format a date as text. If you want to remove spaces in a date, use formatting expression.

     

    The example below shows how I format a date/time to remove spaces. In the next step I compose a string using this formatted date/time with a person's name. This allows me to create a unique ID used in a later step when I assign it as a title to an entity in a document library. 

     

    EERC_2-1692193157207.png

     

    Start by initializing a string variable of your invoice date, with your invoice date property as the value. Then set the variable and format the date.

  • oprandij Profile Picture
    8 on 23 Feb 2023 at 15:01:12
    Re: Remove all spaces from string

    oprandij_0-1677164392359.png

    I am using this Replace Text and it is replacing the spaces with []. What am I doing wrong?

  • arjunrajmails Profile Picture
    14 on 28 Jun 2022 at 14:29:02
    Re: Remove all spaces from string

    In Replace text action,

     

    Enable the option "Use regular expressions for find and replace" and then in text to find use \s


    This will remove all the space in your text and replace with the required character. Use \b to replace with null.

    arjunrajmails_0-1656426506370.png

     

  • HarshChauhan Profile Picture
    52 on 29 Dec 2021 at 15:42:22
    Re: Remove all spaces from string

    can you tell me how can I do this in Power Automate Desktop

  • cbernier12 Profile Picture
    248 on 17 Dec 2020 at 14:55:39
    Re: Remove all spaces from string

    Thanks, I was trying that, however it wouldn't save.  I've discovered PA is kind of finicky and you have to select OK a number of times before formulas will take.

  • Verified answer
    Gopala_Krishna Profile Picture
    1,491 on 17 Dec 2020 at 05:24:42
    Re: Remove all spaces from string

    @cbernier12 

     

    In the below example I have put the sentence inside a variable and used the expression to remove the whitespace.

    You can also directly put the string and use the expression.

     

    replace(variables('test'),' ','')
     
    Replace accepts three arguments, the string, pattern to search for (to be specified in single quotes), pattern to be replaced with(to be specified in single quotes).
     
    If the information shared helps you, please consider giving a thumbs up đź‘Ť and mark solution as resolved.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,731 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,075 Most Valuable Professional

Leaderboard