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;
写错了,应该是 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;
这有两处错语 var t : string; a,b : string; ss := string; nPos : intege; ss : string; nPos : integer;
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;
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;
还有两处错语: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;
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;
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;
var
t : string;
a,b : string;
ss := string;
nPos : intege; ss : string;
nPos : integer;
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;
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;
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;