2026-09-21 11:16:52 +02:00
|
|
|
extension Int {
|
|
|
|
|
|
|
|
|
|
// MARK: Computed
|
|
|
|
|
|
|
|
|
|
/// The amount of euro cents as a price: whole euros bare (`€240`), anything else to the cent (`€12.50`).
|
|
|
|
|
var euros: String {
|
2026-10-25 11:55:43 +01:00
|
|
|
let cents = self % 100
|
|
|
|
|
|
|
|
|
|
return isMultiple(of: 100)
|
2026-09-21 11:16:52 +02:00
|
|
|
? "€\(self / 100)"
|
2026-10-25 11:55:43 +01:00
|
|
|
: "€\(self / 100).\(cents < 10 ? "0" : "")\(cents)"
|
2026-09-21 11:16:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|