Class FloatConverter

java.lang.Object
org.pipservices3.commons.convert.FloatConverter

public class FloatConverter extends Object
Converts arbitrary values into float. Converts using extended conversion rules:
  • Strings are converted to float values
  • DateTime: total number of milliseconds since unix epoсh
  • Boolean: 1 for true and 0 for false

### Example ###

 
 float value1 = FloatConverter.toNullableFloat("ABC"); // Result: null
 float value2 = FloatConverter.toNullableFloat("123.456"); // Result: 123.456
 float value3 = FloatConverter.toNullableFloat(true); // Result: 1
 float value4 = FloatConverter.toNullableFloat(new Date()); // Result: current milliseconds
 
 
  • Constructor Details

    • FloatConverter

      public FloatConverter()
  • Method Details