MakeString separator issue

Hi Guys,

Maybe you will be able to help out. I am using makeString in one of my flows and I need a carriage return as the separator so the text can be placed on newlines everytime in the string. I put in “\r” as the separator but in the output I get \r as string. Anyone knows why am I not getting the carriage return?

Thank You,

You are correct, that won’t work.

Here’s some Java code for a service that will return a line separator string regardless of your platform:
\n for Unix/Linux
\r\n for Windows

Configure the service out to a string named “lineSeparator”,
then paste the following into the body of your new getLineSeparator Java service.

The service can be invoked standalone to set a pipeline variable, or used as a transformer in a map step.


String lineSeparator = System.getProperty(“line.separator”);

IDataCursor pipelineCursor = pipeline.getCursor();
IDataUtil.put( pipelineCursor, “lineSeparator”, lineSeparator );

Maybe you can set the value of the separator by opening the large editor(right click on the textbox and select “open large editor…”) and pressing enter.

Mark, Thanks …that worked perfectly… :slight_smile:

One note on both approaches: often you want to pick a platform-independent separator. Using the line.separator property will mean that when run on Windows you’ll get one separator (\r\n) while on Unix you’ll get another (\n). This may or may not be an issue depending on 1) how the file is processed by the recipients; 2) if the solution will run on both platforms or changes at some point.

Also, the reason \r didn’t work is because character escapes are not supported by makeString.