Extract

<Extension()> _
Public Function Extract(ByVal value As String, ByVal strStart As String, ByVal strEnd As String) As String
    If Not String.IsNullOrEmpty(value) Then
        Dim i As Integer = value.IndexOf(strStart)
        Dim j As Integer = value.IndexOf(strEnd)
        Return value.Substring(i, j - i)
    Else
        Return value
    End If
End Function
Example:
Textbox1.Text = "This is a test. Can you pass?"

Textbox1.Text.Extract("This","test")

Description

Extract string from a string

Details

Double click on the code to select all.

 

;