以下代码错在何处?得到每行的“键”(=前面的内容)
文本内容如下:MM = 666
cpuid.1.eax = "00000000000000110000011011100100"
MM = 8888
cpuid.1.ecx = "0--------------0----------------"
cpuid.1.edx = "-----------0---------0----------"
Delphi的代码如下:
procedure TForm1.Button1Click(Sender: TObject);
var
过List: TStringList;
过I: integer;
begin
过List := TStringList.Create;
过List.LoadFromFile('1.txt');
for 过I := 0 to 过List.Count - 1 do
begin
ShowMessage(过List.Strings[过I]);
过List.Delimiter := '=';
过List.StrictDelimiter := True;
过List.DelimitedText := 过List[过I];
ShowMessage(过List); ===>什么就越界了呢? 不解。{:301_974:}
end;
end; 明白了,少行了。
procedure TForm14.再向虎山行2Click(Sender: TObject);
var
过List: TStringList;
过I: integer;
List2: TStringlist;
begin
过List := TStringList.Create;
过List.LoadFromFile('1.txt');
List2 := TStringList.Create;
for 过I := 0 to 过List.Count - 1 do
begin
ShowMessage(过List.Strings[过I]);
List2.Delimiter := '=';
List2.StrictDelimiter := True;
List2.DelimitedText := 过List[过I];
ShowMessage(List2);
end;
end; 你先问过机器人了吗 (.+?)\s+=\s+"?(.*)"?
页:
[1]