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 Automate
Unanswered

remove line break

(1) ShareShare
ReportReport
Posted on by 234

I have a jotform returning data which I has a line break at the end, and possibly some other data I can't see.

 

"Test

"

 

I am using a switch control, which looks for x equals y

 

So when I run the flow I don't get True for equals "Test"

(nor do I get True for equals "Test

")

 

However I do get True for contains "Test"

 

What can I do to the initial variable to just get the clean text so I can do the equals comparison I need in the switch control?

 

I have tried using trim() with no success.

 

Many thanks for any help

 

 

Categories:
I have the same question (0)
  • Verified answer
    efialttes Profile Picture
    14,756 on at

    Hi!

    So let's assume you have your text stored on a variable called 'myInputString', type string, value

    Test
    
    

    Please note there are two-three line breaks in the value

     

    In order to remove the line break, my suggestion is to use this old trick, which is the following expression:

    replace(variables('myInputString','
    ','')

    Please remember to hit 'enter' to declare the expression

    Hope this helps

     

    Take care and stay healthy!

  • roabus Profile Picture
    2 on at

    Hi, 

     

    I have a similar problem. I'm using "html to text" to convert the body of an email to a string. The problem is that "html to text" inserts a line break in the middle of the text that shows up in the resulting excel table.  

     

    I've tried using the following formula and using your trick with replace(), but when I hit enter nothing happends, it just leaves an empty string. Resulting in the error pictured below. I've also tried \n, but that results in an formula-error where I'm not allowed to save my changes to the formula.

     

    replace(first(skip(split(first(split(body('Html_to_text'),'Produksjonsperiode: ')),'Tittel: '),1)),'',' ')

     

    I've tested all the separate parts, and when the program outputs only skip() without the last first() the resulting array saved in Excel show that there is indeed a \n in the text.

     

    I guess I'm misunderstanding something here. Can you help me with this issue?

     

    Result.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