From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function TryStrToInt64(const S: string; out Value: Int64): Boolean;


extern DELPHI_PACKAGE bool __fastcall TryStrToInt64(const System::UnicodeString S, /* out */ __int64 &Value)/* overload */;


Type Visibility Source Unit Parent
function public
System.SysUtils System.SysUtils


Converts a string that represents an integer (decimal or hex notation) into a number.

TryStrToInt64 converts the string S, which represents an integer-type number in either decimal or hexadecimal notation, into a number, which is assigned to Value. If S does not represent a valid number, TryStrToInt64 returns False; otherwise TryStrToInt64 returns True.

To accept decimal but not hexadecimal values in the input string, you may use code like this:

function TryDecimalStrToInt( const S: string; out Value: Integer): Boolean; begin result := ( pos( '$', S ) = 0 ) and TryStrToInt( S, Value ); end;

See Also