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, nIndexStart) '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

        Else

            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))

        'Else

        '    funGrabBetween = ReturnString

        'End If

    End Function

https://stackoverflow.com/questions/24118188/vb-net-finding-text-between-two-words-in-a-string

Grab Between in String (C#)

private string GrabBetween(string sText, string sParam1, string sParam2)

      {

          String sSource = sText;

        String sDelimStart = sParam1 ;

        String sDelimEnd = sParam2 ;

        int nIndexStart  = sSource.IndexOf(sDelimStart) ;

        int nIndexEnd   = sSource.IndexOf(sDelimEnd,nIndexStart);


        if( nIndexStart >= 0 && nIndexEnd > 0 )

{


            String res = sSource.Substring(nIndexStart + sDelimStart.Length , nIndexEnd - nIndexStart) ;

            return res;

}

        else

                return "";

        return "";

      }


Remove Special Chars from String (Example)

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

https://stackoverflow.com/questions/3701018/remove-special-characters-from-a-string

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))