Name |
boolean()布尔转换 |
Examples |
String s = “true”; boolean b = boolean(s); if (b) { println(“The boolean is true”); } else { println(“The boolean is false”); } |
Description |
Converts an int or String to its boolean representation. For an int, any non-zero value (positive or negative) evaluates to true, while zero evaluates to false. For a String, the value “true” evaluates to true, while any other value (including “false” or “hippopotamus”) evaluates to false. When an array of int or String values is passed in, then a boolean array of the same length is returned. 将 int 或字符串转换为其布尔表示形式。对于 int, 任何非零值 (正值或负数) 的计算结果为 true, 而零计算为 false。对于字符串, 值 “true” 计算为 true, 而任何其他值 (包括 “false” 或 “河马“) 的计算结果为 false。
在传入 int 或字符串值的数组时, 返回相同长度的布尔数组。 |
- 本文固定链接: http://iprocessing.cn/2017/07/20/boolean布尔转换/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表