Convert one measurement value to another ConvUtils unit
1  function Convert ( const Measurement : Double; const FromType, ToType : TConvType ) : Double;
2  function Convert ( const Measurement : Double; const FromType1, FromType2, ToType1, ToType2 : TConvType ) : Double;
The Convert function is a very powerful and useful measurement utility. It converts a Measurement from one type FromType to another ToType.
Version 1
Converts simple values such as miles to kilometres.
Version 2
Converts complex measurements, such as Miles per gallon to Kilometres per litre.
All measurement types are TConvType types, and can have an appropriate value from the TConvFamily below. Note that the from and to values must be in the same family.
cbArea family

cbDistance family

cbMass family

cbTemperature family

cbTime family

cbVolume family
Related commands
CelsiusToFahrenheit Convert a celsius temperature into fahrenheit
DegToRad Convert a degrees value to radians
FahrenheitToCelsius Convert a fahrenheit temperature into celsius
RadToDeg Converts a radian value to degrees
TConvFamily Defines a family of measurement types as used by Convert
TConvType Defines a measurement type as used by Convert
Example code : Convert UK gallons to litres
  gallons, litres : Double;

  // Define the gallons value
  gallons := 1;

  // Convert to litres
  litres := Convert(gallons, vuUKGallons, vuLiters);

  // Display both values
  ShowMessageFmt('%f UK gallons = %f litres',[gallons, litres]);
Show full unit code
   1.00 UK gallons = 4.55 litres
Example code : Convert miles per gallon to kilometres per litre
  milesPerGallon, kilometresPerLitre : Double;

  // We have a very efficient car
  milesPerGallon := 58.5;

  // Convert to kilometres per litre
  kilometresPerLitre := Convert(milesPerGallon,

  // Display both values
  ShowMessageFmt('%f UK miles per gallon = %f km per litre',
                 [milesPerGallon, kilometresPerLitre]);
Show full unit code
   58.5 UK miles per gallon = 20.71 km per litre