squants icon indicating copy to clipboard operation
squants copied to clipboard

Quantity.toString receiving a DecimalFormat

Open Lasering opened this issue 3 years ago • 0 comments

Quantity could have the following methods:

import java.text.DecimalFormat

def toString(decimalFormat: DecimalFormat, uom: UnitOfMeasure[A]): String =
  s"${decimalFormat.format(to(uom))} ${uom.symbol}"
def toString(decimalFormat: DecimalFormat): String =
  toString(decimalFormat, unit)

DecimalFormat is locale aware so on JS this might not work out of the box.

Lasering avatar Mar 24 '22 16:03 Lasering