数字¶
NUMBER : object¶
数字
Kind: global namespace
- NUMBER :
object- .isPositive(num) ⇒
Boolean - .isNegative(num) ⇒
Boolean - .round(num, pos) ⇒
Number - .toCeil(num) ⇒
Integer - .toFloor(num) ⇒
Integer - .parseInt(text) ⇒
Integer - .parseLong(text) ⇒
Long - .parseDouble(text) ⇒
Double
- .isPositive(num) ⇒
NUMBER.isPositive(num) ⇒ Boolean¶
判断是否为正数
Kind: static method of NUMBER
Returns: Boolean - 判断是否为正数
| Param | Type | Description |
|---|---|---|
| num | Number |
数字型参数 |
NUMBER.isNegative(num) ⇒ Boolean¶
判断是否为负数
Kind: static method of NUMBER
Returns: Boolean - 判断是否为负数
| Param | Type | Description |
|---|---|---|
| num | Number |
数字型参数 |
NUMBER.round(num, pos) ⇒ Number¶
提供精确的小数位四舍五入处理
Kind: static method of NUMBER
Returns: Number - 提供精确的小数位四舍五入处理
| Param | Type | Description |
|---|---|---|
| num | Number |
需要四舍五入的数字 |
| pos | Integer |
小数点后保留几位 |
NUMBER.toCeil(num) ⇒ Integer¶
返回大于等于其数字参数的最小整数
Kind: static method of NUMBER
Returns: Integer - 返回大于等于其数字参数的最小整数
| Param | Type | Description |
|---|---|---|
| num | Number |
数字参数 |
NUMBER.toFloor(num) ⇒ Integer¶
返回小于等于其数字参数的最大整数
Kind: static method of NUMBER
Returns: Integer - 返回小于等于其数字参数的最大整数
| Param | Type | Description |
|---|---|---|
| num | Number |
数字参数 |
NUMBER.parseInt(text) ⇒ Integer¶
将数字文本转换成整型并返回
Kind: static method of NUMBER
Returns: Integer - 返回整型值
| Param | Type | Description |
|---|---|---|
| text | String |
数字文本参数 |
NUMBER.parseLong(text) ⇒ Long¶
将数字文本转换成长整型并返回
Kind: static method of NUMBER
Returns: Long - 返回长整型值
| Param | Type | Description |
|---|---|---|
| text | String |
数字文本参数 |
NUMBER.parseDouble(text) ⇒ Double¶
将数字文本转换成浮点型并返回
Kind: static method of NUMBER
Returns: Double - 返回浮点型值
| Param | Type | Description |
|---|---|---|
| text | String |
数字文本参数 |