Constructor
new UnitOfLength()
Members
(static, constant) KILOMETER :String
平方千米/公里。
Type:
- String
(static, constant) METER :String
平方米。
Type:
- String
(static, constant) SEA_MILE :String
海里。
Type:
- String
Methods
(static) mToK(m) → {Number}
米转千米。
Parameters:
Name | Type | Description |
---|---|---|
m |
Number | 米。 |
Returns:
千米。
- Type
- Number
(static) mToSM(m) → {Number}
米转海里。
Parameters:
Name | Type | Description |
---|---|---|
m |
Number | 米。 |
Returns:
海里。
- Type
- Number
(static) spliceNumAndUnitString(num, unit, criticalValueopt, precisionValueopt) → {String}
拼接数值和单位为一个字符串。
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
num |
Number | 数值。 | ||
unit |
String | 单位。 | ||
criticalValue |
Number |
<optional> |
1000.0
|
临界值,用于米和千米之间的自动转换。 |
precisionValue |
Number |
<optional> |
2
|
精度值,保留指定位数的小数。 |
Returns:
拼接好的字符串。
- Type
- String