CreateTime--2月28日09:37:06
Author:Marydon
js判断是否包含指定字符串
var inputValue = "thunder://";//方法一:使用indexOf()方法实现if (inputValue.indexOf("thunder://") >= 0) {alert(1);}//自定义javascript的startWith()和endWith()方法String.prototype.startWith=function(str){var reg=new RegExp("^" + str);return reg.test(this); } String.prototype.endWith=function(str){var reg=new RegExp(str+"$");return reg.test(this); }//实现if (inputValue.startWith("thunder://")) {alert(1);}