你可要使用char数组了。
以下例程是如何得到《A》和〈间的内容:
function tform1.getdm(dm : string) : string;
var k : array [0..500] of char;
    s : string;
    i : integer;
 begin
 i:=0;
 s:='';
 strlcopy(@k,pchar(dm),strlen(pchar(dm)));
 while not((k[i]='<')and(k[i+1]='a')and(k[i+2]='>')) do
 inc(i,1);
 inc(i,3);
while not(k[i]='>') do
begin
 s:=s+k[i];
 inc(i,1);
end;
 result:=s;
 end;

解决方案 »

  1.   

    //function StrPos(const FindString, SourceString: string; StartPos: Integer):  
    Integer; startPos:=strPos('<a>',SourceStr,1);
     EndPos:=strPos('<',SourceStr,startPos);
     ResultStr:=Copy(SourceStr,StartPos+1,EndPos-StartPos);function StrPos(const FindString, SourceString: string; StartPos: Integer): Integer;
    asm   //find http://www......
            PUSH    ESI
            PUSH    EDI
            PUSH    EBX
            PUSH    EDX
            TEST    EAX,EAX
            JE      @@qt
            TEST    EDX,EDX
            JE      @@qt0
            MOV     ESI,EAX
            MOV     EDI,EDX
            MOV     EAX,[EAX-4]
            MOV     EDX,[EDX-4]
            DEC     EAX
            SUB     EDX,EAX
            DEC     ECX
            SUB     EDX,ECX
            JNG     @@qt0
            XCHG    EAX,EDX
            ADD     EDI,ECX
            MOV     ECX,EAX
            JMP     @@nx
    @@fr:   INC     EDI
            DEC     ECX
            JE      @@qt0
    @@nx:   MOV     EBX,EDX
            MOV     AL,BYTE PTR [ESI]
    @@lp1:  CMP     AL,BYTE PTR [EDI]
            JE      @@uu
            INC     EDI
            DEC     ECX
            JE      @@qt0
            CMP     AL,BYTE PTR [EDI]
            JE      @@uu
            INC     EDI
            DEC     ECX
            JE      @@qt0
            CMP     AL,BYTE PTR [EDI]
            JE      @@uu
            INC     EDI
            DEC     ECX
            JE      @@qt0
            CMP     AL,BYTE PTR [EDI]
            JE      @@uu
            INC     EDI
            DEC     ECX
            JNE     @@lp1
    @@qt0:  XOR     EAX,EAX
    @@qt:   POP     ECX
            POP     EBX
            POP     EDI
            POP     ESI
            RET
    @@uu:   TEST    EDX,EDX
            JE      @@fd
    @@lp2:  MOV     AL,BYTE PTR [ESI+EBX]
            CMP     AL,BYTE PTR [EDI+EBX]
            JNE     @@fr
            DEC     EBX
            JE      @@fd
            MOV     AL,BYTE PTR [ESI+EBX]
            CMP     AL,BYTE PTR [EDI+EBX]
            JNE     @@fr
            DEC     EBX
            JE      @@fd
            MOV     AL,BYTE PTR [ESI+EBX]
            CMP     AL,BYTE PTR [EDI+EBX]
            JNE     @@fr
            DEC     EBX
            JE      @@fd
            MOV     AL,BYTE PTR [ESI+EBX]
            CMP     AL,BYTE PTR [EDI+EBX]
            JNE     @@fr
            DEC     EBX
            JNE     @@lp2
    @@fd:   LEA     EAX,[EDI+1]
            SUB     EAX,[ESP]
            POP     ECX
            POP     EBX
            POP     EDI
            POP     ESI
    end;
      

  2.   

    有什么好的方法,大家都继续来讨论一下,最好是用Object Pascal编写的函数,本人不熟汇编语言
      

  3.   

    function StrPos(const FindString, SourceString: string; StartPos: Integer): Integer; 此涵数已测试ok ,能用就可以了.
    delphi中的许多标准涵数都是用 ASM 写的.难到不熟汇编语言就不用这些标准涵数!!!
      

  4.   

    这样如何:
    procedure Go(buf: String);
    var
      p: integer;
    begin
      p:= Pos('<a', buf);
      while p <> 0 do
      begin
        Delete(buf, 1, p);
        p:= Pos('>', buf);
        if p = 0 then
        begin
          ShowMessage('HTML语法有错');
          exit;
        end;
        Delete(buf, 1, p);
        p:= Pos('</a>', buf);
        if p = 0 then
        begin
          ShowMessage('HTML语法有错');
          exit;
        end;
        Form1.ListBox1.Items.Add(Copy(buf, 1, p-1));
        Delete(buf, 1 , p + 3);
        p:= Pos('<a', buf);
      end;
    end;
    考虑了这种情况:<a href="http://1.1.1.1">abc</a>
      

  5.   

    html='abc <a> www.abc.com </a>'if pos('>',html)>0 then
      html=copy(html,pos('>',html)+1,length(html));
    if pos('<',html)>0 then
      html=copy(html,1,pos('<',html));showmessage(html);