cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alexmia
Frequent Visitor

TRIM function not working for variables?

Dear all,

I know there were already some discussions regarding "TRIM" function, but there is something strange happening in my flow for string variables and maybe someone else has already encountered this and could help.

You can find below my flow:

Capturex.PNG

And also the final result:

Captureddd.PNG

So the TRIM function for the "EmailContent" variable defined by me is not working, spaces are not removed = trim(variables('EmailContent'))

Instead, for the HTML to Text is working = trim(body('Html_to_text'))


Anyone knows why is this happening? and how can I make it work also for variables?

Thanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions
ManishJain
Solution Sage
Solution Sage

Hi @alexmia ,

 

Trim is used for removing leading and trailing spaces from the text . Following is the step by step to do so :

https://debajmecrm.com/how-to-remove-trailing-spaces-and-extra-spaces-in-a-string-in-power-automate/

 

Thanks

View solution in original post

3 REPLIES 3
ManishJain
Solution Sage
Solution Sage

Hi @alexmia ,

 

Trim is used for removing leading and trailing spaces from the text . Following is the step by step to do so :

https://debajmecrm.com/how-to-remove-trailing-spaces-and-extra-spaces-in-a-string-in-power-automate/

 

Thanks

View solution in original post

Pstork1
Dual Super User III
Dual Super User III

I think you've been looking at the documentation for Trim() in Power Apps.  In Power Apps it removes all extra spaces from a string.  But in Power Automate (or Azure Logic Apps) Trim() only removes leading and trailing spaces.  Its like TrimEnds() in Power Apps.  Check the docs here: Reference guide for functions in expressions - Azure Logic Apps | Microsoft Docs



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
alexmia
Frequent Visitor

Thanks a lot for your answers!

I used the workaround mentioned by @ManishJain  and it worked for me.
However, it would be nice to have also a trim() function in Power Automate that removes all extra spaces in a string.

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (66,566)