UnitParser is a comprehensive parsing .NET library which can deal with numerous situations related to units of measurement. It is the first part of FlexibleParser. This page refers to the Java version, a conversion of the code which I originally developed in C#.
You can take a look at its source code (
), download
(
) or
, or read
.
To use UnitParser.jar (or UnitParser_without_javadoc.jar), just add it to your project and use the resources in the
UnitParser package
. Additionally to reading the readme file, you should also take a look at
to get a proper idea about its main features.
By bearing in mind the multiple sintax similarities between Java and C#, you might be interested in analysing the resources associated with
(e.g.,
). In any case, note that the Java version doesn't include the following aspects present in the .NET one:
- No custom operators. All the arithmetic operations are performed via the corresponding
UnitP
methods (e.g., UnitP.Multiplication
). - No reliance on the
decimal
type. The main numeric type is double
(or Double
).
The last stable version of UnitParser.jar and UnitParser_without_javadoc.jar is 1.0.9.1 (equivalent to the .NET/C# version 1.0.9.0).