Str2Double Function |
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 |
S | the String to process |
Category
String/Float Conversion RoutinesImplementation
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; |
|