Delphi 5没有
   
    NameValueSeparator
   
   属性,因此必须手动分析各个字符串,例如:
  
  function getKeyByName(fileName, key: string) : string;
var
  dataFile : TStringList;
  i, j: Integer;
  s: string;
begin
  Result := 'Not Found';
  dataFile := TStringList.Create;
  try
    dataFile.LoadFromFile(fileName);
    for i := 0 to dataFile.Count-1 do
    begin
      s := dataFile[i];
      j := Pos('|', s);
      if j = 0 then Continue;
      if Copy(s, 1, j-1) <> key then Continue;
      s := Copy(s, j+1, MaxInt);
      if s <> '' then Result := s;
      Break;
    end;
  finally
    dataFile.Free;
  end;
end;