这句正则的意思是什么

来源:百度知道 编辑:UC知道 时间:2024/06/16 16:55:25
E=new RegExp(A+'$','i')中的
A+'$' 是什么意思?
全句在这里:
String.prototype.EndsWith=function (A,B) {
var C=this.length;
var D=A.length;
if(D>C)return false;
if(B) {
var E=new RegExp(A+'$','i');
return E.test(this);
}else return (D==0||this.substr(C-D,D)==A);
}
最后这个else return (D==0||this.substr(C-D,D)==A);又是什么意思啊?

为E =新regexp的(一+'$',' ' )中的

全文是:
string.prototype.endswith =功能(甲,乙) (
无功c = this.length ;
无功= a.length ;
如果(四>三)返回FALSE ;
如果(二) (
无功为E =新regexp的(一+'$',' ' ) ;
返回e.test (本) ;
) ,否则返回(四== 0 | | this.substr (的C - D , D )的== 1 ) ;


最后一句是;

否则,返回(四== 0 | | this.substr (的C - D , D )的== 1 ) ;