📜  字符串转十进制 swift 代码示例

📅  最后修改于: 2022-03-11 15:00:59.089000             🧑  作者: Mango

代码示例1
let decimal: Decimal = 51000000000
let str = String(describing: decimal)

let savedValues = UserDefaults.standard

savedValues.set(str, forKey:"jitterClickCost")
savedValues.synchronize()

let value = savedValues.string(forKey: "jitterClickCost") ?? "0"

let result = Decimal(string: value)