Dim location() as integer
Dim iCount
iCount=0
for i= 1 to len(str)
   if mid(str,i,1)="<" then
      iCount=iCount+1
      redim preserve location(icount)
   elseif mid(str,i,1)=">" then      outstr=mid(str,location(icount),i-location(icount)+1)
      iCount=iCount-1
   end if
next i  
以上是一个一个找的简单程序
需要完善

解决方案 »

  1.   

    我的更简单Private Function Check(ByVal sPara As String) As Boolean
        
        Dim iReturn1 As Long
        Dim iReturn2 As Long
        
        iReturn1 = InStr(1, sPara, "<", vbTextCompare)
        iReturn2 = InStr(1, sPara, "/>", vbTextCompare)
        
        If iReturn1 <> 0 And iReturn2 <> 0 Then
            Check = True
        Else
            Check = False
        End If
        
    End FunctionPrivate Sub Command1_Click()
        Dim sTest As String
        sTest = "asdf< asadfad df>dfads"
        MsgBox Check(sTest)
    End Sub
      

  2.   

    function isin(iStr as string,sStr as string)as boolean
    s$="<"+istr+"/>"
    ss$=replace(sStr,s$,"#"+s$)
    if instr(1,ss$,"#"+s$) then
    isin=true
    else
    isin=false
    end if
    end function