关于一个字符串的问题 在线等 我有一个这样的字符串,内容为abcdefg*abcdefalsk*asdlkjh*alskd*alsd*我要把*前的信息提取出来.我记的delphi中有一个相关的函数, 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var str:string; intI:Integer;begin str:='abcdefg*abcdefalsk*asdlkjh*alskd*alsd*'; intI:=pos('*',str); while intI>0 do begin self.ListBox1.Items.Add(copy(str,1,IntI-1)); str:=copy(str,intI+1,length(str)-IntI); intI:=Pos('*',str); end;end; 我要把他们分解以后,给不同的变量,例如'**asdlkjh*alskd*alsd*'a:=abcdefgb:=abcdefalsk...这些都由程序自动来完成. 你可以把这里用一个TStringList来保存截取后的字符串var str,a,b:string; intI:Integer; strList:TStringList;begin strList:=TStringList.Create; str:='abcdefg*abcdefalsk*asdlkjh*alskd*alsd*'; intI:=pos('*',str); while intI>0 do begin strList.Add(copy(str,1,IntI-1)); str:=copy(str,intI+1,length(str)-IntI); intI:=Pos('*',str); end; ///// a:=strList.Strings[0]; b:=strList.Strings[1]; ................ strList.Free;end; 基本上这个就是Pos+Copy+System.Delete方法的组合,经常用 如何在子窗体关闭的同时关闭主窗体 CSDN学习史(第一问) 已知进程名,再得到窗口名 求Inside深入核心—VCL架构剖析 电子书 这样的控件该怎么做? 模拟速达的报表! 在paradox中如何存入图片? 一个关于远程控制的问题 数据库中,我用locate函数检索一条记录,数据库的指针指到当前符合条件的记录,这时候,我想操作数据库,比如下移一条记录,用next为什么 小弟问了一个mdi的问题. 有武汉单位要老家伙吗? 用dbgrid实现这样的效果 .....
str:string;
intI:Integer;
begin
str:='abcdefg*abcdefalsk*asdlkjh*alskd*alsd*';
intI:=pos('*',str);
while intI>0 do
begin
self.ListBox1.Items.Add(copy(str,1,IntI-1));
str:=copy(str,intI+1,length(str)-IntI);
intI:=Pos('*',str);
end;
end;
'**asdlkjh*alskd*alsd*'
a:=abcdefg
b:=abcdefalsk
.
.
.
这些都由程序自动来完成.
str,a,b:string;
intI:Integer;
strList:TStringList;
begin
strList:=TStringList.Create; str:='abcdefg*abcdefalsk*asdlkjh*alskd*alsd*';
intI:=pos('*',str);
while intI>0 do
begin
strList.Add(copy(str,1,IntI-1));
str:=copy(str,intI+1,length(str)-IntI);
intI:=Pos('*',str);
end;
/////
a:=strList.Strings[0];
b:=strList.Strings[1];
................
strList.Free;
end;