如a:=abc:defgh;
怎么变成a:=abc;b:=defgh;

解决方案 »

  1.   

    var
      t : string;
      a,b : string;
      ss := string;
      nPos : intege;
    begin
      ss := "abc:defgh";
      t := ":";
      nPos := Pos(:,ss);
      a := copy(ss,1,nPos - 1);
      b := Copy(ss,nPos + 1,500);
    end;
      

  2.   

    写错了,应该是
    var
      t : string;
      a,b : string;
      ss := string;
      nPos : intege;
    begin
      ss := "abc:defgh";
      t := ":";
      nPos := Pos(t,ss);
      a := copy(ss,1,nPos - 1);
      b := Copy(ss,nPos + 1,500);
    end;
      

  3.   

    这有两处错语
    var
      t : string;
      a,b : string;
      ss := string;
      nPos : intege;  ss : string;
      nPos : integer;
      

  4.   

    procedure TForm1.Button1Click(Sender: TObject);
    var i:integer;
        k:string;
    begin
    for i:=1 to length(edit1.text) do
       begin
         if copy(edit1.text,i,1)<>'/' then
            k:=k+copy(edit1.text,i,1)
         else
          begin
           memo1.Lines.Add(k);
           k:='';
          end;
       end;
    end;
      

  5.   

    Var
      Str:String;
      I,Pos1,Num:Integer;
    begin
      Str:=Edit1.Text;
      for I:=1 to length(Edit1.text) do
      begin
        Pos1:=Pos(':',str)+1;
        if copy(Str,Pos1,1)= '=' then
          pos1:=pos1+1;    str:=copy(Str,pos1,(length(Str)-pos1+1));    if pos(':',str)<>0 then
          Num:=pos(':',str)-1
        else
          Num:=length(Str);
        S:=Copy(str,1,Num);
        Memo1.Lines.Add(S);
        if Pos(':',Str)=0 then
          Exit;
      end;
    end;
      

  6.   

    还有两处错语:var
      t     : string;
      a,b   : string;
      ss    : string;
      nPos  : integer;
    begin
      ss    := 'abc:defgh';//错处
      t     := ':';        //错处
      nPos  := Pos(t,ss);
      a     := copy(ss,1,nPos - 1);
      b     := Copy(ss,nPos + 1,500);
    end;