//```ops
//title:一些常用的js方法
//descr:
//```
/**
* @label:判断字符串是否一以xx开头
*/
String.prototype.startsWith = function(s) {
if (s == null || s == "" || this.length == 0 || s.length > this.length)
return false;
if (this.substr(0, s.length) == s)
return true;
else
return false;
return true;
}
/**
* @label:判断字符串是否一以xx结尾
*/
String.prototype.endsWith = function(s) {
if (s == null || s == "" || this.length == 0 || s.length > this.length)
return false;
if (this.substring(this.length - s.length) == s)
return true;
else
return false;
return true;
}