在netsuite中找到一个字符串,然后打印出来 [英] Find a string in netsuite, and print it

查看:69
本文介绍了在netsuite中找到一个字符串,然后打印出来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在netsuite suitescript 1.0中,我要检查字符串是否具有一组关键字.在javascript中,有一个函数称为.includes("Set_of_keywords_to_be_searched"); 我在netsuite中尝试了.include,但是它给出了错误.

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.

例如:

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

我想在netsuite中使用类似的功能.

I want similar function in netsuite.

推荐答案

使用RegExptest方法.请参见 MDN参考

看起来像

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

String#includes仅在ES2015中添加. NetSuite正在运行Rhino 1.7 JS引擎,该引擎不支持任何ES2015或更高版本的JS功能.

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.

这篇关于在netsuite中找到一个字符串,然后打印出来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆