11 lines
352 B
Swift
11 lines
352 B
Swift
import Foundation
|
|
|
|
public extension String.StringInterpolation {
|
|
mutating func appendInterpolation(double: Double, fractionDigits: Int = 2) {
|
|
let formatter = NumberFormatter()
|
|
formatter.numberStyle = .decimal
|
|
formatter.maximumFractionDigits = fractionDigits
|
|
appendInterpolation(formatter.string(from: NSNumber(value: double))!)
|
|
}
|
|
}
|