一个字符串里包含了四个空格,怎样取第四个空格后的字符串
for i:=1 to Length(ThisStr) do
begin
if ThisStr[i]:= then
begin
k:=K+1;
if K=4 then
begin
R:=i;
end;
end;
end;
TrimedStr:=copy(ThisStr,R,n);
i;=pos(4个空格,str)
str1:=RightStr(str,Legnth(str)-i+1)
var
i: integer;
p: integer;
str: string;
s: string;
begin
p := 0
i := 1;
repeat
if str[i]= then
inc(p);
inc(i);
until p=4;
s := rightstr(str, length(str)-p);
end;
for i:=1 to 4 do
begin
index:=pos( ,yourStr);
yourStr[index]:=;
end;
StrYouWanted:=copy(yourStr,index,length(yourStr)-index);
good
copy(string,5,length(string))
copy(str,pos( ,str)+1,length(str))
将你的代码改了一下
var
i,k,m,n:integer;
str:string;
begin
k:=0;
str:=trim(123 4 5 6 7 89 999);
for i:=1 to Length(str) do
begin
if str[i]= then
begin
k:=K+1;
if K=3 then m:=i;
if K=4 then n:=i;
end;
end;
showmessage(copy(str,m,n-m));