Here is another example: type TDay = (Monday = 0, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday);
TDayHelper = record helper for TDay function AsByte: Byte; function ToString: string; end; function TDayHelper.AsByte: Byte; begin Result := Ord(Self); end; function TDayHelper.ToString: string; begin case Self of Monday: Result := 'Monday'; Tuesday: Result := 'Tuesday'; Wednesday: Result := 'Wednesday'; Thursday: Result := 'Thursday'; Friday: Result := 'Friday'; Saturday: Result := 'Saturday'; Sunday: Result := 'Sunday'; end; end; And you can have code like this: var Day: TDay; S: string; begin Day := TDay.Monday; S := Day.ToString.ToLower; WriteLn(S); end;
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal