标签:als cti class ring substring str with ret function
1 String.prototype.endWith=function(str){ 2 if(str==null||str==""||this.length==0||str.length>this.length) 3 return false; 4 if(this.substring(this.length-str.length)==str) 5 return true; 6 else 7 return false; 8 return true; 9 } 10 //或者使用正则表达式 11 String.prototype.endWith = function(str) { 12 var reg = new RegExp(str + "$"); 13 return reg.test(this); 14 }
标签:als cti class ring substring str with ret function
原文地址:https://www.cnblogs.com/blogwolf/p/13218788.html