Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jakob_h
Partner - Contributor II

Replace line feed (ascii value 10)

I want to replace line feed with another character in an out block. I can't get the replace function to do it. Anyone know how to do this?

Labels (3)
1 Solution

Accepted Solutions
jonashertz
Contributor III

Didn't see it was about automations and had no idea how to do it.. but got curious 😉

So I built an automation accepting multi line input. In the output block "data to output" I used "Add formula -> Text Function -> Replace". Then for "old value" I used "Add formula -> Text Function -> Line break".

Running the automation with input:

text
with
multiple
lines

gives me the result "test;with;multiple ;lines".

Maybe that is more what you are looking for?

jonashertz_0-1706182107456.png

 

View solution in original post

6 Replies
anat
Master

=replace('text1',chr(10),'text2')

jonashertz
Contributor III

Yes the replace function is what you are looking for. Here I'm replacing newline character with semi colon:

let vMyString = 'line1' & chr(10) & 'line2';

load
replace( '$(vMyString)', chr(10),chr(59)) as NewString
autogenerate 1;

marcus_sommer

Maybe the line-break char-index isn't 10 else 13 or both in combination. Copy the data into an editor like Notepad++ to see which chars are really there.

jakob_h
Partner - Contributor II
Author

As you can see, this is related to an automation and not a script. I'm fully aware how to do it in the script

jonashertz
Contributor III

Didn't see it was about automations and had no idea how to do it.. but got curious 😉

So I built an automation accepting multi line input. In the output block "data to output" I used "Add formula -> Text Function -> Replace". Then for "old value" I used "Add formula -> Text Function -> Line break".

Running the automation with input:

text
with
multiple
lines

gives me the result "test;with;multiple ;lines".

Maybe that is more what you are looking for?

jonashertz_0-1706182107456.png

 

jakob_h
Partner - Contributor II
Author

It's seems like the solution i was looking for. Couldn't find the linebreak function before you posted it here. I must have looked for another name