[fpc-devel] Feature announcement: Type helpers

Michael Van Canneyt michael at freepascal.org
Wed Feb 6 11:01:14 CET 2013



On Wed, 6 Feb 2013, Mattias Gaertner wrote:

> On Wed, 06 Feb 2013 10:49:36 +0100
> Sven Barth <pascaldragon at googlemail.com> wrote:
>
>> [...] Hello Free Pascal community!
>
>> === example begin ===
>>
>> var
>>    i: LongInt;
>> begin
>>     Writeln(i.ToString);
>> end.
>
> And how is toString declared?

Something like

type
   TLongIntHelper = type helper for LongInt
     function toString : AnsiString;
   end;

function TLongIntHelper.toString : AnsiString;

begin
   Result:=IntToStr(Self);
end;

Michael.



More information about the fpc-devel mailing list