function - 为什么 PowerBuilder 函数 Integer("") 返回零
问题描述
在 PowerBuilder 中,函数 Integer("") 返回零。空字符串怎么可能变为零?为什么函数 Integer("") 不返回 null?
解决方案
这就是该方法的定义方式,并且从一开始就是如此。无效输入或不兼容的数据类型会导致返回零 (0)。如果输入为 null,则返回 null。
如果您需要区分零字符串值和非数字输入,请在使用 Integer 之前使用 IsNumber 方法进行检查。
推荐阅读
- angular - 如何将日期时间 UTC 转换为本地时间 Angular?
- php - 如何检查 url 是 tel: 还是 javascript: type
- c# - 是否可以将 XML 文档反序列化为 XML 文档而不是目标文件?
- node.js - 如何修复'类扩展值未定义不是构造函数或空'NodeJS
- java - 如何修复无法解析符号“activity_main”?
- angular - NativeScript/Angular 中的延迟或睡眠功能
- java - android 应用程序在收到 1 或 2 条消息后崩溃
- html - CSS在jsfiddle中工作但不在我的本地服务器上?
- javascript - .location 和 getBoundingClientRect() 函数都返回相对于右上角的 x,y 坐标
- python - Scipy 的solve_ivp 给出“ValueError: setting an array element with a sequence”