Just wondering how this is implemented. Is it compiler magic? or something we could write?
Hi Paul
This looks like a helper for the Integer ‘‘class’’.
Does this help?
Regards
Graeme
Thanks @Graeme,
I forgot that I had been interrupted when I was looking through a “ToString” grep list.
I didn’t know it could work this way for value types.
//
// System.SysUtils.pas
//
TIntegerHelper = record helper for Integer { for LongInt type too }
public
const
MaxValue = 2147483647;
MinValue = -2147483648;
function ToString: string; overload; inline;
function ToBoolean: Boolean; inline;
function ToHexString: string; overload; inline;
function ToHexString(const MinDigits: Integer): string; overload;
function ToSingle: Single; inline;
function ToDouble: Double; inline;
function ToExtended: Extended; inline;
class function Size: Integer; inline; static;
class function ToString(const Value: Integer): string; overload; inline; static;
class function Parse(const S: string): Integer; static;
class function TryParse(const S: string; out Value: Integer): Boolean; inline; static;
end;