[SOLVED] Remove line breaks
mbeckmann
New Altair Community Member
Hi folks,
I'm looking for a way to remove all the line breaks from a text.
I've tried \r\n, regex, without success.
Could you please help me?
Thanks in advance,
I'm looking for a way to remove all the line breaks from a text.
I've tried \r\n, regex, without success.
Could you please help me?
Thanks in advance,
Tagged:
0
Answers
-
Hi,
try the Replace operator to replace \n with nothing, as in the process below (the first two operators are just to create an example set which contains values with linebreaks).<?xml version="1.0" encoding="UTF-8" standalone="no"?>
Best,
<process version="5.2.003">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.2.003" expanded="true" name="Process">
<process expanded="true" height="116" width="614">
<operator activated="true" class="text:create_document" compatibility="5.2.001" expanded="true" height="60" name="Create Document" width="90" x="112" y="30">
<parameter key="text" value="first second line"/>
</operator>
<operator activated="true" class="text:documents_to_data" compatibility="5.2.001" expanded="true" height="76" name="Documents to Data" width="90" x="313" y="30">
<parameter key="text_attribute" value="text"/>
</operator>
<operator activated="true" class="replace" compatibility="5.2.003" expanded="true" height="76" name="Replace" width="90" x="514" y="30">
<parameter key="replace_what" value="(\n)"/>
</operator>
<connect from_op="Create Document" from_port="output" to_op="Documents to Data" to_port="documents 1"/>
<connect from_op="Documents to Data" from_port="example set" to_op="Replace" to_port="example set input"/>
<connect from_op="Replace" from_port="example set output" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
Marius0 -
Thanks, this works fine!0