Int - leacode/SwiftWings GitHub Wiki

Int Extensions

Source: Sources/Extensions/Foundation/Int

Tests: Tests/Extensions/Int

Int+Extensions.swift

  • bytes(_:) exposes big-endian byte arrays for serialization.
  • half divides safely when magnitude is greater than 1.
  • BinaryInteger additions: Simplified/Traditional Chinese spell-outs, isEven, and conversions to Double/String.

Int+ChineseCurrency.swift

  • Delegates to Double.chineseMoneySpell so integers can be spelled in formal Chinese currency without manual casting.

Example

let value = 42
print(value.bytes()) // [0, 0, 0, 0, 0, 0, 0, 42] on 64-bit
print(value.half as Any) // Optional(21)
print(value.simplifiedChinese ?? "") // "ε››εδΊŒ"
print(value.chineseMoneySpell ?? "") // "θ‚†ζ‹Ύθ΄°εœ†ζ•΄"
⚠️ **GitHub.com Fallback** ⚠️