delphi中
复制下面到memo中
name:xiaowang age:20 email:[email protected] phone:111111
name:aqo age:22 email:[email protected] phone:22222
name:fan age:33 email:[email protected] phone:7878787实现如下:
点击提取按钮 提取第一条信息 xiaowang 20 [email protected] 111111
点击next按钮 提取下一条信息 aqo 22 [email protected] 22222
再点next按钮 提取第3条该怎么实现! 最好给个代码.不行给几个函数吧 呵呵
解决立即给分拉 .在线等.....
复制下面到memo中
name:xiaowang age:20 email:[email protected] phone:111111
name:aqo age:22 email:[email protected] phone:22222
name:fan age:33 email:[email protected] phone:7878787实现如下:
点击提取按钮 提取第一条信息 xiaowang 20 [email protected] 111111
点击next按钮 提取下一条信息 aqo 22 [email protected] 22222
再点next按钮 提取第3条该怎么实现! 最好给个代码.不行给几个函数吧 呵呵
解决立即给分拉 .在线等.....
showmessage(Memo1.Lines[1]);
showmessage(Memo1.Lines[2]);
定义个integer的变量xxx做指示
第一条
xxx:=1;
showmessage(Memo1.Lines[1]);下一条if xxx<Memo1.lines.count then
begin
inc(xxx);
showmessage(Memo1.Lines[xxx]);
end;
另外 memo中顺序不一定就这么整齐啊 有可能回车乱了
name:xiaowang age:20 email:[email protected]
phone:111111
name:aqo age:22 email:[email protected] phone:22222
name:fan age:33
email:[email protected] phone:7878787
呵呵
问题附加:
memo中顺序不一定就这么整齐啊 有可能回车乱了
name:xiaowang age:20 email:[email protected]
phone:111111
name:aqo age:22 email:[email protected] phone:22222
name:fan age:33
email:[email protected] phone:7878787
intI:Integer;
function getStr( str:string ):string;
var
aindex,eIndex,pIndex:Integer;
name,age,email,phone:string;
begin
aindex:=pos( 'age',str );
name:=copy(str,6,aindex-7);
eIndex:=pos( 'email', str );
age:=copy(str,aindex+4,eindex-aIndex-5);
pIndex:=Pos( 'phone',str );
email:=copy(str,eIndex+6,pIndex-eIndex-7);
phone:=copy(str,pIndex+6,length(str));
Result:=name+' '+age+' '+email+' '+phone;
end;
begin
for IntI:=0 to self.Memo1.Lines.Count-1 do
begin
getStr( Memo1.Lines.Strings[IntI] );
end;
end;
name:xiaowang age:20 email:[email protected]
phone:111111
name:aqo age:22 email:[email protected] phone:22222
name:fan age:33
email:[email protected] phone:7878787
此时点击按钮效果一样