解决方案 »

  1.   

    自己搞定了,有同样需求的看看吧 嘿嘿
    procedure TForm1.Button1Click(Sender: TObject);
    var  str: WideString;
    FTextList  :TStrings;
    i:integer;
    k:integer;timestr:String;
    content:WideString;
    lastIndex:integer;
    timeNum:integer;
    n:integer;
    begin
    FTextList:=TStringList.create;
    if(op1.Execute) then
       begin
         FTextList.loadFromfile(op1.FileName);
         for i:=0 to FTextList.count -1 do
         begin
         str := FTextList[i];
         lastIndex:=LastDelimiter(']',str);
         //showmessage(inttostr(lastIndex));
         //ÏÂÃæ´¦Àítime±êÇ©
         timeNum:=lastIndex div 10;
         showmessage(inttostr(timeNum));     content :=copy(str,lastIndex+1,length(str)-lastIndex) ;
         //m1.Lines.Add(content);
             if timeNum=0 then    m1.Lines.Add(str)
             else
             for n:=0 to timeNum-1 do
             begin
               timestr:=copy(str,n*10+1,10) ;
               m1.Lines.Add(timestr+content);
             end;
          end;
        end;
    end;
      

  2.   

    Result := StringReplace(str, '][', ']' + #13#10 + '[', [refReplaceAll]);