feat(can-payment): 다국적 통화 표기 지원 및 결제 금액 표시 개선
- KRW 고정 표기에서 벗어나 PG/해외 결제 등 다양한 통화 표기를 정확히 지원하기 위함
This commit is contained in:
@@ -44,4 +44,14 @@ extension String {
|
||||
|
||||
// 출처 - https://ios-development.tistory.com/379
|
||||
}
|
||||
|
||||
func formatCurrency(currencyCode: String, locale: Locale = .current) -> String {
|
||||
let formatter = NumberFormatter()
|
||||
formatter.numberStyle = .currency
|
||||
formatter.locale = locale
|
||||
formatter.currencyCode = currencyCode
|
||||
|
||||
let dec = NSDecimalNumber(string: self)
|
||||
return formatter.string(from: dec) ?? "\(currencyCode) \(self)"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user