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条该怎么实现! 最好给个代码.不行给几个函数吧 呵呵
解决立即给分拉 .在线等.....

解决方案 »

  1.   

    人懒到这种程度也真是,自己不学着写永远都不会写.对memo的lines进行循环,用pos或者Delimiter来分割下就能得到
      

  2.   

    showmessage(Memo1.Lines[0]);
    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;
      

  3.   

    楼上看清楚噢 不是简单的showmessage啊 提取line中的部分
    另外 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
    呵呵
      

  4.   

    楼上大哥 你看清楚了问题吗? 我还不知道怎么写 呵呵 麻烦你给我敲几下吧 
    问题附加:
    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
      

  5.   

    var
      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;
      

  6.   

    楼上的没有看清问题 不能用line循环吧 不过谢谢了 会加分的 请看清我的附加东西 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
    此时点击按钮效果一样
      

  7.   

    那就只能是按"name:","age:"等这些关键字去查找,然后再获取你所需要的信息了,如果关键字也不能确定的话那就没法找你想要的了..嘿嘿...