Reputation: 42260
Consider the following Kotlin code sample:
import java.util.*
fun main(vararg args: String) {
Currency
.getAvailableCurrencies()
.sortedBy { it.currencyCode }
.forEach {
val cc = it.currencyCode
val fd = it.defaultFractionDigits
println("$cc = $fd")
}
}
Example output:
ADP = 0
AED = 2
AFA = 2
...
XAG = -1
What I want to know specifically relating to currencies such as XAG (Troy Ounce of Silver), what is meant by having a -1 (negative 1) fractional digit?
Upvotes: 0
Views: 386
Reputation: 6732
In the case of pseudo-currencies, such as IMF Special Drawing Rights, -1 is returned.
So it just means that XAG isn't a real currency.
Source: https://developer.android.com/reference/kotlin/java/util/Currency#getDefaultFractionDigits()
Upvotes: 3