Between_HTMLtag

Returns the full text found between HTML tag open and close by either and index of character in that text or by searching for string in that block and returning the index location of some text.
like between It is actually two functions
Between_HTMLtag and Between_HTMLtag_ByIndex

Returns number as below ...
1: If sStr is between and
2: If sStr is between and
0: anything else

CodeFunctionName
What is this?

Public

Tested

Original Work
Function Between_HTMLtag(sStr, Page7, Optional HTMLtag = "ix:")
    ' Returns number as below ... (using Between_HTMLtag_ByIndex)
    ' 1: If sStr is between <ix: ... > and </ix: ... >
    ' 2: If sStr is between </ix: ... > and <ix: ... >
    ' 0: anything else
    ' Needs vbinstr(), Between_HTMLtag_ByIndex
    Rett = 0
    StartPoint = VBInstr(sStr, Page7)
    If StartPoint = 0 Then GoTo ByeBye
    Rett = Between_HTMLtag_ByIndex(StartPoint, Page7, HTMLtag)
ByeBye:
    Between_HTMLtag = Rett
End Function
Function Between_HTMLtag_ByIndex(sStrID, Page7, Optional HTMLtag = "ix:")
    ' Returns number as below ...
    ' 1: If sStrID is between <ix: ... > and </ix: ... >
    ' 2: If sStrID is between </ix: ... > and <ix: ... >
    ' 0: anything else
    '
    Rett = 0
    Found1 = 0
    Found2 = 0
    HTMLOpen = " <" & HTMLtag
    HTMLClose = " </" & HTMLtag
    For I = sStrID To 1 Step -1
        If UCase(Mid(Page7, I, Len(HTMLOpen))) = UCase(HTMLOpen) Then            ' Found open before we find close
            Found1 = I
            Exit For
        ElseIf UCase(Mid(Page7, I, Len(HTMLClose))) = UCase(HTMLClose) Then    ' Found close before Open
            Found1 = -1
            Exit For
        End If
    Next
    ' Found1 either -1 or I
    For I = sStrID To Len(Page7)
        If UCase(Mid(Page7, I, Len(HTMLOpen))) = UCase(HTMLOpen) Then            ' Found open before we find close
            Found2 = -1
            Exit For
        ElseIf UCase(Mid(Page7, I, Len(HTMLClose))) = UCase(HTMLClose) Then    ' Found close before Open
            Found2 = I
            Exit For
        End If
    Next
    ' Found2 either -1 or I
    If Found1 > 0 And Found2 > 0 Then
        Rett = 1
    ElseIf Found1 < 0 And Found2 < 0 Then
        Rett = 2
    End If
ByeBye:
    Between_HTMLtag_ByIndex = Rett
End Function

sStr, Page7, Optional HTMLtag = "ix:"
or
sStrID, Page7, Optional HTMLtag = "ix:"

Views 339

Downloads 14

CodeID
DB ID