How to trim an empty line from a string

Seems pretty simple but i have a text value with an empty line. I’d like to ‘trim’ that… (so the value starts with the text instead of a linebreak))

How?

Hi @robin.speekenbrink,

Could you please provide us with the sample input and output expected?

The situation was that we were reading a file that could possibly be empty, filled with text or even filled with text that started with a blank line. We then concattenated that into an array and joined as a plain string.
The final string result must not have a leading empty line.

Our working solution is to “trim” the reading of the file, adding a conditional to the buildup of the array and then having the joining of the array still there. This works but feels rather clunky.

So, problem solved for now.

Did you find the ‘String: Trim characters’ mapper?
Or was it not sufficient?

Otherwise maybe a quick regex could’ve fixed it?

As already mentioned in my previous post: a combination of trim and a conditional buildup of the array… (array_filter() would have been more clean here)