zcash-android-wallet-sdk / cash.z.wallet.sdk.ext / kotlin.Double / toUsdString

toUsdString

fun Double?.toUsdString(maxDecimals: Int = USD_FORMATTER.maximumFractionDigits, minDecimals: Int = USD_FORMATTER.minimumFractionDigits): String

Format a USD value into USD with the given number of digits, represented as a string. Start with USD -> end with USD.

Parameters

maxDecimals - the number of decimal places to use in the format. Default is 6 because ZEC is glorious.

minDecimals - the minimum number of digits to allow to the right of the decimal.

Return
this Double ZEC value represented as a string with at least minDecimals and at most maxDecimals, which is 2 by default. Zero is always represented without any decimals.