| Str2Int64 Function | 
Unit
QESBPCSConvert
Declaration
Function Str2Int64(const S: string): Int64;
Description
Removes Thousand Separators if they are present as well as any leading or trailing white spaces (ie <= #32). Non-numeric will return 0.
| Parameters | 
| S | the String to process | 
Category
String/Integer Conversion RoutinesImplementation
 
| function Str2Int64 (const S: string): Int64;
var
     S2: string;
     Error: Integer;
begin
     S2 := StripThousandSeparators (Trim (S)); // Remove Thousands Separators, if any
     try
          Val (S2, Result, Error);
          if Error <> 0 then
               Result := 0 // Return 0 for non-numeric
     except
          Result := 0; // Return 0 for non-numeric
     end;
End; | 
|  |