[fpc-pascal] EnumToString
Tomas Hajny
XHajT03 at hajny.biz
Tue Nov 1 09:26:17 CET 2011
On Tue, November 1, 2011 08:41, Juha Manninen wrote:
Hi,
> I remember there is a way to get a string representation of an enumerated
> type directly without using a lookup string array, but I forgot the
> syntax.
> Lazarus uses only lookup arrays, maybe because the other syntax is new.
>
> How is the syntax?
type
TNum = (One, Two, Three);
var
N: TNum;
S: string;
begin
N := One;
WriteLn (N);
N := Two;
WriteStr (S, N);
WriteLn (S);
end.
Tomas
More information about the fpc-pascal
mailing list