扩展startWith方法
String.prototype.startWith=function(str){
if(str==null||str==""||this.length==0||str.length>this.length){
return false;
}
if(this.substr(0,str.length)==str){
return true;
}else{
return false;
}
return true;
};
转自:https://blog.csdn.net/weixin_38246518/article/details/79394417?utm_source=blogkpcl0