RAD Studio VCL Reference
SysUtils.TryStrToInt64 Function

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

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

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;
   result := ( pos( '$', S ) = 0 ) and TryStrToInt( S, Value );


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!