Package 

Class CurrencyFormatterKt

    • Method Detail

      • convertZatoshiToZecString

         final static String convertZatoshiToZecString(Zatoshi $self, Integer maxDecimals, Integer minDecimals)

        Format a Zatoshi value into ZEC with the given number of digits, represented as a string. Start with Zatoshi -> End with ZEC.

        Parameters:
        maxDecimals - the number of decimal places to use in the format.
        minDecimals - the minimum number of digits to allow to the right of the decimal.
      • toZecString

         final static String toZecString(Double $self, Integer maxDecimals, Integer minDecimals)

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

        Parameters:
        maxDecimals - the number of decimal places to use in the format.
        minDecimals - the minimum number of digits to allow to the right of the decimal.
      • toZecString

         final static String toZecString(BigDecimal $self, Integer maxDecimals, Integer minDecimals)

        Format a Zatoshi value into ZEC with the given number of decimal places, represented as a string. Start with ZeC -> End with ZEC.

        Parameters:
        maxDecimals - the number of decimal places to use in the format.
        minDecimals - the minimum number of digits to allow to the right of the decimal.
      • toUsdString

         final static String toUsdString(Double $self, Integer maxDecimals, Integer minDecimals)

        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.
        minDecimals - the minimum number of digits to allow to the right of the decimal.
      • toUsdString

         final static String toUsdString(BigDecimal $self, Integer maxDecimals, Integer minDecimals)

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

        Parameters:
        maxDecimals - the number of decimal places to use in the format.
        minDecimals - the minimum number of digits to allow to the right of the decimal.
      • currencyFormatter

         final static NumberFormat currencyFormatter(Integer maxDecimals, Integer minDecimals)

        Create a number formatter for use with converting currency to strings. This probably isn't needed externally since the other formatting functions leverage this, instead. Leverages the default rounding mode for ZEC found in ZEC_FORMATTER.

        Parameters:
        maxDecimals - the number of decimal places to use in the format.
        minDecimals - the minimum number of digits to allow to the right of the decimal.
      • convertZatoshiToZec

         final static BigDecimal convertZatoshiToZec(Zatoshi $self, Integer scale)

        Convert a Zatoshi value into ZEC, right-padded to the given number of fraction digits, represented as a BigDecimal in order to preserve rounding that minimizes cumulative error when applied repeatedly over a sequence of calculations. Start with Zatoshi -> End with ZEC.

        Parameters:
        scale - the number of digits to the right of the decimal place.
      • convertZecToZatoshi

         final static Zatoshi convertZecToZatoshi(Double $self, Integer decimals)

        Format a Double ZEC value as a Long Zatoshi value, by first converting to ZEC with the given precision. Start with ZEC -> End with Zatoshi.

        Parameters:
        decimals - the scale to use for the intermediate BigDecimal.
      • toZec

         final static BigDecimal toZec(Double $self, Integer decimals)

        Format a Double ZEC value as a BigDecimal ZEC value, right-padded to the given number of fraction digits. Start with ZEC -> End with ZEC.

        Parameters:
        decimals - the scale to use for the resulting BigDecimal.
      • toZec

         final static BigDecimal toZec(BigDecimal $self, Integer decimals)

        Format a BigDecimal ZEC value as a BigDecimal ZEC value, right-padded to the given number of fraction digits. Start with ZEC -> End with ZEC.

        Parameters:
        decimals - the scale to use for the resulting BigDecimal.
      • toUsd

         final static BigDecimal toUsd(Double $self, Integer decimals)

        Format a Double USD value as a BigDecimal USD value, right-padded to the given number of fraction digits. Start with USD -> End with USD.

        Parameters:
        decimals - the scale to use for the resulting BigDecimal.
      • toUsd

         final static BigDecimal toUsd(BigDecimal $self, Integer decimals)

        Format a BigDecimal USD value as a BigDecimal USD value, right-padded to the given number of fraction digits. Start with USD -> End with USD.

        Parameters:
        decimals - the scale to use for the resulting BigDecimal.
      • convertZecToUsd

         final static BigDecimal convertZecToUsd(BigDecimal $self, BigDecimal zecPrice)

        Convert this ZEC value to USD, using the given price per ZEC. Start with ZEC -> End with USD.

        Parameters:
        zecPrice - the current price of ZEC represented as USD per ZEC
      • convertUsdToZec

         final static BigDecimal convertUsdToZec(BigDecimal $self, BigDecimal zecPrice)

        Convert this USD value to ZEC, using the given price per ZEC. Start with USD -> End with ZEC.

        Parameters:
        zecPrice - the current price of ZEC represented as USD per ZEC.
      • convertUsdToZec

         final static Double convertUsdToZec(Double $self, Double zecPrice)

        Convert this USD value to ZEC, using the given price per ZEC. Start with USD -> End with ZEC.

        Parameters:
        zecPrice - the current price of ZEC represented as USD per ZEC.
      • convertCurrency

         final static BigDecimal convertCurrency(BigDecimal $self, BigDecimal zecPrice, Boolean isUsd)

        Convert this value from one currency to the other, based on given price and whether this value is USD. If starting with USD -> End with ZEC. If starting with ZEC -> End with USD.

      • toAbbreviatedAddress

         final static String toAbbreviatedAddress(String $self, Integer startLength, Integer endLength)

        Abbreviates this string which is assumed to be an address.

        Parameters:
        startLength - the number of characters to show before the elipsis.
        endLength - the number of characters to show after the elipsis.
      • isShielded

         final static Boolean isShielded(String $self)

        Convenience function that returns true when this string starts with 'z'.