func numberAsPercentage(_ number: Double) -> String {
let formatter = NumberFormatter()
formatter.numberStyle = .percent
formatter.percentSymbol = ""
return formatter.string(from: NSNumber(value:number))!
}
原文链接:https://www.f2er.com/swift/322590.html