校验是否为非零的正整数

5年以前  |  阅读数:409 次  |  编程语言:JavaScript 
function isPInt(value,minLength=null,maxLength=undefined) {
    if(!isNum(value)) return false;

    let regexp = new RegExp(`^[1-9][0-9]${anysicIntLength(minLength,maxLength)}$`);
    return regexp.test(value.toString());
}

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8