有个字符串s=‘12 23,89 13 37 三星电器 2003年2月28号’,怎么样把其中12,23等数字或中文字符‘三星电器’等取出阿?大哥帮忙阿

解决方案 »

  1.   

    var
    str,s :string;
    begin
      s:='';
      str:=copy(s,1,2);//得到12
        .
        .
        . end;
      

  2.   

    pos函数确定子字符串位置
    copy函数提取子字符串
    函数详细说明请自己看帮助
      

  3.   

    Function getchar1(tempstr:String):String;
    var i,TempInt:LongInt;
        tempstr1,tempstr2:String;     //($B0A1..$D7F9)
    begin
      result:='';
      i:=1;
      While i<length(tempstr) do
      begin
        tempstr1:=copy(tempstr,i,2);
        TempInt:=WORD(tempstr1[1]) shl 8 + WORD(tempstr1[2]);
        if (TempInt>=$B0A1)and(TempInt<=$D7F9) then
        begin
          result:=result+tempstr1+'/';
          i:=i+2;
        end else
        begin
          result:=result+copy(tempstr,i,1)+'/';
          i:=i+1;
        end;
      end;
    end;
    这个看看可否帮上你的忙。