安大互联
财经热点 > Asp编程 > Numeric - Check - with - some - Regular - Expression - magic
【问题文章】Numeric - Check - with - some - Regular - Expression - magic
浏览次数:【406】  发布日期:2009-8-13 12:09:22    文章分类:Asp编程   
专题:问题文章】 【
 
<script language="javascript" runat="server">
    // Checks that the string supplied can be expressed as a number (float)
    function isNumeric(strNumber) {
        return (strNumber.search(/^(-|\+)?\d+(\.\d+)?$/) != -1);
    }

    // Checks that the string supplied can be expressed as an unsigned number (float)
    function isUnsignedNumeric(strNumber) {
        return (strNumber.search(/^\d+(\.\d+)?$/) != -1);
    }

    // Checks that the string supplied can be expressed as an integer
    function isInteger(strInteger) {
        return (strInteger.search(/^(-|\+)?\d+$/) != -1);
    }

    // Checks that the string supplied can be expressed as an unsigned integer
    function isUnsignedInteger(strInteger) {
        return (strInteger.search(/^\d+$/) != -1);
    }
</script>

手机扫码浏览该文章
 ● 相关资讯推荐
 ● 相关资讯专题
  • 网络建设业务咨询

   TEl:13626712526