Str2Double Function
Converts a string into a Double.

Unit
QESBPCSConvert

Declaration
Function Str2Double(const S: string): Double;

Description
Removes Thousand Separators if they are present as well as any leading or trailing white spaces (ie <= #32). If Number is Valid but out of Range then MaxDouble will be returned for a greater value and -MaxDouble for a lesser value. Non-numeric will return 0 unless you set ESBRaiseFloatError to true.

Also ignores Percentage Signs (%).

Parameters
the String to process

Category
String/Float Conversion Routines

Implementation

function Str2Double (const S: string): Double;
var
     X: Extended;
begin
     X := Str2Float (S);
     if X > MaxDouble then // Check with in boundaries
          Result := MaxDouble
     else if X < -MaxDouble then
          Result := -MaxDouble
     else
          Result := X; // Return Value
End;


HTML generated by Time2HELP
http://www.time2help.com