Double - leacode/SwiftWings GitHub Wiki
Source: Sources/Extensions/Foundation/Double
Tests: Tests/Extensions/Double
-
toString()formats to two decimal places viaString(format:). -
BinaryFloatingPoint.toInt()performs a simpleIntcast for any floating-point value.
-
chineseMoneySpellformats a decimal as uppercase RMB (壹贰叁…) usingNumberFormatterwith thezh_Hans_CNlocale and additional replacements.
let price = 1234.5
print(price.toString()) // "1234.50"
print(price.chineseMoneySpell ?? "") // "壹仟贰佰叁拾肆圆伍角"
print((12.5 as BinaryFloatingPoint).toInt()) // 12