对不起,没看清题目:var
s:string;
begin
s:='01.01.02.03';
memo1.Text:=stringreplace(s,'.',#13#10,[rfIgnoreCase,rfReplaceAll]);
while pos(#13#10,memo1.Text)<>0 do
begin
showmessage(memo1.Lines[0]);
memo1.Text:=stringreplace(memo1.Text,#13#10,'.',[rfIgnoreCase]);
end;
showmessage(memo1.Lines[0]);
var
s:string;
begin
s:='01.01.02';
memo1.Text:=stringreplace(s,'.',#13#10,[rfIgnoreCase,rfReplaceAll]);
edit1.Text:=memo1.Lines[0];
edit2.Text:=memo1.Lines[1];
edit3.text:=memo1.Lines[2];
end;
var
str:string;
int,i:INTEGER;
str_bak:string;
begin
str:='10.20.30';
for i:=0 to 1 do
begin
int:=pos('.',str);
str_bak:=leftstr(str,int-1);
showmessage(str_bak);
delete(str,1,int);
end;
showmessage(str);
end;
1.如果没节的长度是固定的
var
sstr:string;//源串
dstr:string;//目标串
tstr:string;//临时串
I:INTEGER;
BEGIN
FOR I:=1 TO LEN(Sstr)/3
begin
tstr:=copy(i,sstr,3);
dstr:=copy(1,tstr,2);
showmessage('这是一个'+dstr)