Insert carriage return when concatinating strings

How can you append a carriage return to the end of the string. Is there a way to perform a set value on a variable where the literal is equal to a carriage return, like “/r/n”?

End of line in Java is ‘\n’.

Try hunting for it using pub.string:replace, turning the reg exp functionality on.

> a way to perform a set value on a variable where the literal is
> equal to a carriage return, like “/r/n”?

Hmm, since you’re setting the variable in a flow, just right click and choose “Use Larger Editor”. Then you press “Enter” in the large text box that pops up. This will probably set the output to “\n” since that’s Java’s newline character as Nick says.

If you want to set it to “\r\n”, you probably need a Java service - pub.string:replace only recognizes \r\n regular expressions in its input.

right click and choose “Use Larger Editor”. Then you press “Enter” in the large text box that pops up. It will definately work.

This will work only for windows though.
Thanks

I used: URLDecode with input “%0D%0A” the output variable will contain the CRLF pair.

Depending on requirements, use concat to append to a string.

> I used: URLDecode with input “%0D%0A”
> the output variable will contain the CRLF pair.

A generic solution! Very nice lateral thinking.

In Unix also it is working

URLDecode with input “%0D%0A” the output variable will contain the CRLF pair.

This works for me also…
Thanks Fosterb. :slight_smile: