编辑:说三道四文库 发布时间:2018-04-26 03:28
HTML文档下载
WORD文档下载
PDF文档下载
谢谢
Function ExtractStr(index:integer;Allstr:string):string;
var
strlist:tstringlist;
begin
strlist:=tstringlist.Create;
strlist.CommaText:=Allstr;
if index>=strlist.count then
begin
result:='';
exit;
end;
try
result:=strlist.Strings[index-1];
except
result:='';
end;
strlist.Destroy;
end;
1.空格码是#10
2.用li_pos:=Pos(#10,as_input);找出位置
3 用MidStr函数可以取出所要的字符了。
如:
li_pos:=Pos(#10,'dfds dffds');
Fstr:=MidStr('dfds dffds',1,li_pos-1);
Bstr:=MidStr('dfds dffds',li_pos+1,StrLen('dfds dffds')-li_pos);
我以前用的的方法:
ss :Tstringlist;
s := 'dfds df fds wer qwer qwer';
s := trim(s);
while length(s) > 0 do
begin
ss.add(copy(s,1,pos(' ',s)));
s := copy(s,pos(' ',s),length(s));
end;
先例:
var
one,two,three,strtmp: string;
intPos: integer;
begin
strtmp := edit.text;
intPos := pos(' ', strtmp);
one := copy(strtmp, 1, intPos - 1);
strtmp := copy(strtmp, intPos + 2, 255);
intPos := pos(' ', strtmp);
two := copy(strtmp, 1, intPos - 1);
strtmp := copy(strtmp, intPos + 2, 255);
three := copy(strtmp,intPos+2,255);
end;
同意DainelLee(¥$£ 吃肉的菜鸟 £$¥) 所说的方法
DainelLee(¥$£ 吃肉的菜鸟 £$¥) 的方法比较灵活。
DainelLee(¥$£ 吃肉的菜鸟 £$¥)
这个方法好。