1

I am using the awesome JScience library to convert units. What is bothering me:
The output of for example WATT.times(HOUR) is W·h.

What I want to output is just Wh. Is it possible to change the output for all units without implementing an own UnitFormat? I know I could label all these units but that is a lot of work, too.

Stephan
  • 4,395
  • 3
  • 26
  • 49

1 Answers1

0

I found no JScience/UnitsOfMeasurement based solution so I did it by myself:

public static String formatUnit(final Unit unit) {
  return unit.toString().replace("·", "");
}
Stephan
  • 4,395
  • 3
  • 26
  • 49