static bool IsNumeric(object Expression)

来源(support.microsoft.com)

From: http://support.microsoft.com/kb/329488

static bool IsNumeric(object Expression)
    // IsNumeric Function
    static bool IsNumeric(object Expression) {
    // Variable to collect the Return value of the TryParse method.
        bool isNum;

    // Define variable to collect out parameter of the TryParse method. If the conversion fails, the out parameter is zero.
        double retNum;

    // The TryParse method converts a string in a specified style and culture-specific format to its double-precision floating point number equivalent.
    // The TryParse method does not generate an exception if the conversion fails. If the conversion passes, True is returned. If it does not, False is returned.
        isNum = Double.TryParse(Convert.ToString(Expression), System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.InvariantInfo, out retNum );
        return isNum;
    }


其他资源
IsDate 函数 (Visual Basic)
IsArray 函数 (Visual Basic)
IsDBNull 函数
IsError 函数
IsNothing 函数
IsNumeric 函数 (Visual Basic)
IsReference 函数
Object 数据类型
Date 数据类型 (Visual Basic)
TypeName 函数 (Visual Basic)

Link: http://www.asm32.net/article_details.aspx?id=4411


浏览次数 90 发布时间 2009-02-11 15:22:46 从属分类 asp.net(C#) 【评论】【 】【打印】【关闭
 
| www.asm32.net | 2006版 | 资料中心 | linux | asm/asm32 | C/C++ | VC++ | java | Python | 书签 | ASP.Net书签 | 京ICP备09029108号-1