GetBetween Function

I think this function is very useful.
It allows to get the text which is between to other strings from a entire long string/web page.

Mainly it’s used to parse informations in webpages.

Private Shared Function GetBetween(ByRef strSource As String, _
ByRef strStart As String, ByRef strEnd As String, _
Optional ByRef startPos As Integer = 0) As String
        Dim iPos As Integer, iEnd As Integer, lenStart As Integer = strStart.Length
        Dim strResult As String
        strResult = String.Empty
        iPos = strSource.IndexOf(strStart, startPos)
        iEnd = strSource.IndexOf(strEnd, iPos + lenStart)
        If iPos <> -1 AndAlso iEnd <> -1 Then
            strResult = strSource.Substring(iPos + lenStart, iEnd - (iPos + lenStart))
        End If
        Return strResult
    End Function