18 lines
419 B
Kotlin
18 lines
419 B
Kotlin
package com.example.demo.domain
|
|
|
|
import java.text.DecimalFormat
|
|
|
|
interface StdMoneyFormatable : StdMoney {
|
|
companion object {
|
|
const val MONEY_FORMAT = "#,##0.##"
|
|
}
|
|
|
|
fun formatMoneyValue(): String {
|
|
val df = DecimalFormat(MONEY_FORMAT)
|
|
return df.format(getMoneyValue())
|
|
}
|
|
|
|
fun formatMoneyDisplay(): String {
|
|
return "${formatMoneyValue()} ${getMoneyCurrency()}"
|
|
}
|
|
} |