Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find a string in netsuite, and print it

In netsuite suitescript 1.0, I want to check whether a string has a set of keywords. In javascript there is function called as .includes("Set_of_keywords_to_be_searched"); I tried .includes in netsuite but its giving error.

Eg:

var str = "Hello world, welcome to the javascript.";
var n = str.includes("world");     // this will return true
var n = str.includes("Apple");     // this will return false

I want similar function in netsuite.

like image 782
Galdiator Avatar asked Dec 03 '25 13:12

Galdiator


1 Answers

Use a RegExp and the test method. See MDN Reference

Will look something like

var pattern = /world/;
var n = pattern.test(str);

String#includes was only added in ES2015. NetSuite is running the Rhino 1.7 JS engine, which does not support any ES2015 or later features of JS.

like image 159
erictgrubaugh Avatar answered Dec 08 '25 07:12

erictgrubaugh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!