Grab Between in String

Function funGrabBetween(sText As String, sParam1 As String, sParam2 As String, Optional ReturnString As String = "") As String

       Dim sSource As String = sText 'String that is being searched

        Dim sDelimStart As String = sParam1 'First delimiting word

        Dim sDelimEnd As String = sParam2 'Second delimiting word

        Dim nIndexStart As Integer = sSource.IndexOf(sDelimStart) 'Find the first occurrence of f1

        Dim nIndexEnd As Integer = sSource.IndexOf(sDelimEnd) 'Find the first occurrence of f2

        If nIndexStart > -1 AndAlso nIndexEnd > -1 Then '-1 means the word was not found.

            Dim res As String = Strings.Mid(sSource, nIndexStart + sDelimStart.Length + 1, nIndexEnd - nIndexStart - sDelimStart.Length) 'Crop the text between

            Return res 'Display


            Return ReturnString

        End If

        'Dim lngLocOfAvail As Integer = InStr(sText, sParam1, CompareMethod.Text)

        'If lngLocOfAvail > 0 Then

        '    'funGrabBetween= mid(sText ,lngLocOfAvail+len(sParam1),instr(lngLocOfAvail,sText,sParam2)-lngLocOfAvail-+len(sParam1))

        '    'funGrabBetween = Mid(sText, lngLocOfAvail + Len(sParam1), InStr(lngLocOfAvail + Len(sParam1), sText, sParam2, 1) - lngLocOfAvail - +Len(sParam1))


        '    funGrabBetween = ReturnString

        'End If

    End Function

Remove Special Chars from String (Example)

Dim cleanString As String = Regex.Replace(yourString, "[^A-Za-z0-9\-/]", "")

Find a string by using a Predicate (ie for String(Of) )

            Dim dFind As String = dLogonSessions.Find(Function(value As String) value = sLine)

            If dFind IsNot Nothing Then

                Debug.Print(sLine & "  " & dFind.ToString)

            End If

Read File Contents (Text) at once

    Dim fileReader As String
    fileReader = My.Computer.FileSystem.ReadAllText(strArg(0))