PLC解密网-PLC培训学习-工控自动化人才技术交流

超级管理员

453

帖子

1378

回复

3110

积分

楼主
发表于 2020-02-09 20:52:07 | 查看: 1648 | 回复: 0

startsWith()方法用来判断当前字符串是否是以另外一个给定的子字符串“开头”的,根据判断结果返回 true 或 false。
参数:
str.startsWith(searchString [, position]);
searchString
要搜索的子字符串。
position
在 str 中搜索 searchString 的开始位置,默认值为 0,也就是真正的字符串开头处。

示例:

var str = "To be, or not to be, that is the question.";

alert(str.startsWith("To be"));         // true
alert(str.startsWith("not to be"));     // false
alert(str.startsWith("not to be", 10)); // true



您需要登录后才可以回帖 登录 | 立即注册

技术支持 KZYPLC V2.1 © 2020-2027

欢迎光临昆山中宇工控PLC论坛!您是第 6617779 位访问者, 日访问量: 23547 总访问量: 16216692,当前 2024-05-03 17:01:06 在线人数:103

ICP备案证书号: 苏ICP备14003016-2号