首页 > 解决方案 > 为什么 PowerBuilder 函数 Integer("") 返回零

问题描述

在 PowerBuilder 中,函数 Integer("") 返回零。空字符串怎么可能变为零?为什么函数 Integer("") 不返回 null?

标签: functionintegerpowerbuilder

解决方案


这就是该方法的定义方式,并且从一开始就是如此。无效输入或不兼容的数据类型会导致返回零 (0)。如果输入为 null,则返回 null。

如果您需要区分零字符串值和非数字输入,请在使用 Integer 之前使用 IsNumber 方法进行检查。


推荐阅读