function inputCheck(inputValue: string) {
var re = /(^[0-9]{1,1}$)|(^[0-9]{1,2}[\.]{1}[0-9]{1,1}$)/;
return re.exec(inputValue) != null;
}
该函数inputCheck接受一个字符串参数inputValue,使用正则表达式检查其是否为一位或两位数字,且可包含一个小数点。如果输入值匹配此模式,函数将返回true,否则返回false。
function inputCheck(inputValue: string) {
var re = /(^[0-9]{1,1}$)|(^[0-9]{1,2}[\.]{1}[0-9]{1,1}$)/;
return re.exec(inputValue) != null;
}
1747
835
402

被折叠的 条评论
为什么被折叠?