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!



View solution in original post

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (3,349)