File content validation not working


(Satish Kumar) #1

I’m validating file content in the script node with Javascript" startsWith() "and “endsWith()” methods.
The issue here is startsWith is working in my case but endsWith not working if the file content has multiple lines.

Working Scenario : var str = “Hello world, welcome to the universe.”;
var n = str.endsWith(“universe.”); // It gives “true”

Error Scenario: var str = “Hello world,
welcome
to the
universe.”;

var n = str.endsWith(“universe.”); // It gives “false”

I tried all the esc sequence characters.


(Yoga Ramya Mendu) #2

Hi @m.satish512,

We have checked the usecase.

Ideally, the string in multiple lines is not supported even in general html/javascript editor with appropriate escape also. The result will not be rendered.

image

In the same way, even in the script node in bot platform, a string in multiple lines in considered as syntax error and will not be providing appropriate result.

image

This is nothing specific to platform. Kindly check in a general javascript editor and let us know.

Regards,
Yoga Ramya.