先用instr('名称:'),instr('型号:')定位,然后截取他们之间的字符串,最后trim()一下

解决方案 »

  1.   

    pos函数取得位置,然后调用COPY
      

  2.   

    function interceptingString(sourestr: String): TStringList;  //截取字符串;(得到当前打印机名称和位置);
    begin
      Result := TStringList.Create ;
      if sourestr = '' then
        exit;
      Result.Add(copy(sourestr,1,pos(' on ',sourestr)));
      Result.Add(copy(sourestr,pos(' on ',sourestr)+1,length(sourestr)-pos(' on ',sourestr)));
    end;
      

  3.   

    function interceptingString(sourestr: String): TStringList;  //截取字符串;(得到当前打印机名称和位置);
    begin
      Result := TStringList.Create ;
      if sourestr = '' then
        exit;
      Result.Add(copy(sourestr,1,pos(' on ',sourestr)));
      Result.Add(copy(sourestr,pos(' on ',sourestr)+1,length(sourestr)-pos(' on ',sourestr)));
    end;
      

  4.   

    s2:=copy(str,index2,index3-index2-1);
      

  5.   

    谢谢各位的帮助!    我这个是从一张excel表中抽出来的一行记录,也就是说,还有很多同结构的记录需要导入到数据表中。
        s1,s2为字段名    
        我希望能够得到一些通用的语句来把这样的记录导入数据