Why isvalid(“integer”,“1,5”) = YES?

前端 未结 4 2062
不知归路
不知归路 2020-12-17 18:02

Why does #isValid(\"integer\",\"1,5\")# output YES? I expected it to output NO like #isValid(\"integer\",\"1.5\")# does.

I\'m going to vali

4条回答
  •  渐次进展
    2020-12-17 18:25

    If you want to make absolutely sure you have an Integer, you could use Java Integer methods.

    
    createObject("java","java.lang.Integer").parseInt("1,5");
    
    

    The parseInt() method throws when it is given anything that cannot be interpreted as an Integer. This includes "1,5".

提交回复
热议问题