1

手順について助けが必要です。別の手順で作成された stringlist にいくつかの文字列を保存したいと考えています。これどうやってするの?

よりよく理解するために、適切な場所にコメントを書きました。

procedure GetIniNamesWithoutExt(IniPfade: TStringList);
var
  i, suchPunkt: integer;
  ini: TIniFile;
  Modul, fullFileName, IniName: String;
begin
  try
  for i := 0 to IniPfade.Count-1 do
  begin
    fullFileName := IniPfade.Strings[i];
    Modul := ExtractFileName(fullFileName);  // Dateiname aktueller Ini + .Ini Endung
    suchPunkt := Pos('.', Modul);
    IniName := Copy(Modul, 1, suchPunkt-1);  // Aktueller Modulname ohne ini Endung
    // Here should be the Code for saving the String "IniName" to a StringList which is created in procedure a. Procedure a calls the procedure GetIniNamesWithoutExt.
  end;
  finally

  end;
end;
4

1 に答える 1

4

どうですか

procedure GetIniNamesWithoutExt(IniPfade, Module: TStrings);
var
  i, suchPunkt: integer;
  ini: TIniFile;
  Modul, fullFileName, IniName: String;
begin
  Module.BeginUpdate;
  try
    for i := 0 to IniPfade.Count-1 do
    begin
      fullFileName := IniPfade.Strings[i];
      Modul := ExtractFileName(fullFileName);  // Dateiname aktueller Ini + .Ini Endung
      suchPunkt := Pos('.', Modul);
      IniName := Copy(Modul, 1, suchPunkt-1);  // Aktueller Modulname ohne ini Endung
      Module.Add(IniName);
    end;
  finally
    Module.EndUpdate;
  end;   
end;

そして手順Aから:

procedure A;
var 
  Module: TStringList;
begin
  Module := TStringList.Create;
  try
    GetIniNamesWithoutExt(IniPfade , Module);
    // Do Whatever you want with "Module"
  finally
    Module.Free;
  end;
end;
于 2013-03-13T14:48:03.507 に答える