StrToFloatDef

Top  Previous  Next

Prototype

 

FloatOutput:= StrToFloatDef (strInput, FloatDefault)

 

Description

 

It transforms the string assigned by parameter into real number. If the number cannot be converted the output is the default value

 

Parameters

 

StrInput: string to be transformed into real number.

 

floatDefault: Default Value

 

Returned value

 

FloatOutput: number obtained by conversion.

 

Notes

 

None.

 

Example

 

// It repeats the loop...

Repeat

 

// It asks user

StrValue:=ShowInputBox('Insert number from 0 to 1','Number','?');

 

// It converts the string value to float number

FloatValue:=StrToFloatDef(StrValue,-1.0);

 

// ... until the value is out of range

Until (FloatValue>=0.0) and (FloatValue<=1.0);