1

如何在delphi7中转换此代码...

 procedure Tform1.button1.click(sender: tobject);  
 var
   LTZID: string;
 begin
  // Write each time zone ID on the console 
  for LTZID in TBundledTimeZone.KnownTimeZones(true) do
  WriteLn(LTZID);
end;

谢谢...

4

1 回答 1

4
procedure Tform1.button1.click(sender: tobject);
 var
   i: Integer;
 begin
  // Write each time zone ID on the console
  for i := Low(TBundledTimeZone.KnownTimeZones(true))
      to High(TBundledTimeZone.KnownTimeZones(true)) do
    WriteLn(TBundledTimeZone.KnownTimeZones(true)[i]);
end;

或者,稍微优化一下:

procedure Tform1.button1.click(sender: tobject);
 var
   KnownTimeZones: TStringDynArray;
   i: Integer;
 begin
  // Write each time zone ID on the console
  KnownTimeZones := TBundledTimeZone.KnownTimeZones(true);
  for i := Low(KnownTimeZones) to High(KnownTimeZones) do
    WriteLn(KnownTimeZones[i]);
end;
于 2012-08-16T07:37:22.050 回答