cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mrpowergage
Resolver I
Resolver I

remove line break

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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
efialttes
Super User
Super User

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!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

2 REPLIES 2
efialttes
Super User
Super User

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!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



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

 

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

AI Builder AMA June 7th carousel (up on May 25th, take down June 8th) (1).png

'Ask Microsoft Anything' about AI Builder!

The AI Builder team invite you to ask questions and provide helpful answers at our next AMA.

Users online (1,431)