Str2Int64 Function
Converts a string into a Int64.

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
the String to process

Category
String/Integer Conversion Routines

Implementation

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;


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