Trim \n from string

trying to trim \n from a string using a string node, but it doesn’t do it.
Should I use another way?

Lars,

If you could, please include screenshots whenever possible, it helps us better understand the context of your question.

but it doesn’t do it.

Are you seeing an error? Does the original string remain untouched? Any additional information you can provide here would be great.

Which String operation are you using? Is the \n at the end of the string you are trying to parse?

Thank you,
Heath

Sorry, I’m using the “split” function, not trim.
And yes, the original string remains untouched.

Lars,

So I have a better understanding of what you’re trying to accomplish, could you tell me a bit more about what you’re looking to achieve?

Are you looking to split the string where \n occurs? Or, are you looking to trim \n from the end of the string? Or neither?

Heath

I’m hoping to do both.

FYI, the original string comes from a file read (encoded as UTF8)

Lars,

This is a classic issue of encoding and escaping characters.

The easiest way for you to do this is to use a Mutate Node with the following configuration (you can set your ouput to whatever you’d like):

image

Then in your String node you can Split with {{working.splitter}} as seen:

image

Let me know if this works for you.

Heath

Did not realize I could do it that way!

That worked.

Thanks

1 Like