DELPHI 两个Tstrings对比

2025-05-17 11:15:11
推荐回答(1个)
回答(1):

var
  i:Integer;
  list:TStrings;
begin
  list:=TStringList.Create;
  try
    for I := 0 to lv1.Items.Count -1 do
    begin
        if pos('0.04*14 1/4',lv1.Items[i].SubItems.Strings[2]) > 0 then
        begin
            lv1.Items[i].SubItems.Strings[7]='切袋组';//组别赋值
            if lv1.Items[i].SubItems.Strings[8] = 'A' then
            begin
                lv1.Items[i].SubItems.Strings[5] := 'AA';
            end;
             if lv1.Items[i].SubItems.Strings[8] = 'B' then
            begin
                lv1.Items[i].SubItems.Strings[5] := 'BB';
            end; 
             if lv1.Items[i].SubItems.Strings[8] = 'C' then
            begin
                lv1.Items[i].SubItems.Strings[5] := 'CC';
            end;                     
        end 
     
  finally
    list.Free;
  end;

这是根据题意做的,可是根据你的代码理解,好像没那么简单,应该说题主没讲清楚需求