/** * Returns the value as a 0.12 type string. More digits after the decimal place will be used * if necessary, but two will always be present. */ public String toFriendlyString() { return FRIENDLY_FORMAT.format(this).toString(); }
/** * Returns the value as a 0.12 type string. More digits after the decimal place will be used * if necessary, but two will always be present. */ public String toFriendlyString() { return FRIENDLY_FORMAT.format(this).toString(); }
/** * <p> * Returns the value as a plain string. The result is unformatted with no trailing zeroes. For * instance, a value of 150000 "smallest units" gives an output string of "0.0015". * </p> */ public String toPlainString() { return PLAIN_FORMAT.format(this).toString(); }
/** * <p> * Returns the value as a plain string. The result is unformatted with no trailing zeroes. For * instance, a value of 150000 "smallest units" gives an output string of "0.0015". * </p> */ public String toPlainString() { return PLAIN_FORMAT.format(this).toString(); }
/** * <p> * Returns the value as a plain string denominated in BTC. * The result is unformatted with no trailing zeroes. * For instance, a value of 150000 satoshis gives an output string of "0.0015" BTC * </p> */ public String toPlainString() { return PLAIN_FORMAT.format(this).toString(); }
/** * <p> * Returns the value as a plain string denominated in BTC. * The result is unformatted with no trailing zeroes. * For instance, a value of 150000 satoshis gives an output string of "0.0015" BTC * </p> */ public String toPlainString() { return PLAIN_FORMAT.format(this).toString(); }
/** * <p> * Returns the value as a plain string. The result is unformatted with no trailing zeroes. For * instance, a value of 150000 "smallest units" gives an output string of "0.0015". * </p> */ public String toPlainString() { return PLAIN_FORMAT.format(this).toString(); }
/** * <p> * Returns the value as a plain string denominated in BTC. * The result is unformatted with no trailing zeroes. * For instance, a value of 150000 satoshis gives an output string of "0.0015" BTC * </p> */ public String toPlainString() { return PLAIN_FORMAT.format(this).toString(); }
/** * Returns the value as a 0.12 type string. More digits after the decimal place will be used * if necessary, but two will always be present. */ public String toFriendlyString() { return FRIENDLY_FORMAT.format(this).toString(); }
/** * <p> * Returns the value as a plain string. The result is unformatted with no trailing zeroes. For * instance, a value of 150000 "smallest units" gives an output string of "0.0015". * </p> */ public String toPlainString() { return PLAIN_FORMAT.format(this).toString(); }
/** * Returns the value as a 0.12 type string. More digits after the decimal place will be used if necessary, but two * will always be present. */ public String toFriendlyString() { return FRIENDLY_FORMAT.code(0, currencyCode).format(this).toString(); }
/** * Returns the value as a 0.12 type string. More digits after the decimal place will be used if necessary, but two * will always be present. */ public String toFriendlyString() { return FRIENDLY_FORMAT.code(0, currencyCode).format(this).toString(); }
/** * Returns the value as a 0.12 type string. More digits after the decimal place will be used if necessary, but two * will always be present. */ public String toFriendlyString() { return FRIENDLY_FORMAT.code(0, currencyCode).format(this).toString(); }
@Test public void testSigns() throws Exception { assertEquals("-1.00", NO_CODE.format(Coin.COIN.negate()).toString()); assertEquals("@1.00", NO_CODE.negativeSign('@').format(Coin.COIN.negate()).toString()); assertEquals("1.00", NO_CODE.format(Coin.COIN).toString()); assertEquals("+1.00", NO_CODE.positiveSign('+').format(Coin.COIN).toString()); }
@Test public void withLocale() throws Exception { final Coin value = Coin.valueOf(-1234567890l); assertEquals("-12.34567890", NO_CODE.withLocale(Locale.US).format(value).toString()); assertEquals("-12,34567890", NO_CODE.withLocale(Locale.GERMANY).format(value).toString()); assertEquals("-१२.३४५६७८९०", NO_CODE.withLocale(new Locale("hi", "IN")).format(value).toString()); // Devanagari }
@Test public void codeSeparator() throws Exception { assertEquals("BTC@0.00", MonetaryFormat.BTC.codeSeparator('@').format(Coin.ZERO).toString()); }
/** * Test clearing all codes, and then setting codes after clearing. */ @Test public void noCode() throws Exception { assertEquals("0", MonetaryFormat.UBTC.noCode().shift(0).format(Coin.ZERO).toString()); // Ensure that inserting a code after codes are wiped, works assertEquals("dBTC 0", MonetaryFormat.UBTC.noCode().code(1, "dBTC").shift(1).format(Coin.ZERO).toString()); }