[ActionScript 3.0] AS3 判断字符串是否为数字

trace(isNaN(Number("0")));//false
trace(isNaN(Number("123")));//false
trace(isNaN(Number("sw3f23")));//true
trace(isNaN(Number("swf")));//true
judgeNumber("123");//123 is number
function judgeNumber(value:String):void
{
    if(isNaN(Number(value))){
        trace(value+" is not number");
    }else{
        trace(value + " is number");
    }
}

 

你可能感兴趣的:([ActionScript 3.0] AS3 判断字符串是否为数字)