How to VB.NET String.EndsWith()

EndsWith in VB.NET String Class check if the Parameter String EndsWith the Specified String.


  1. suffix - The passing String for it EndsWith .


  1. Boolean - Yes/No

If the String EndsWith the Parameter String it returns True

If the String doesnt EndsWith the Parameter String it return False

For ex : "This is a Test".EndsWith("Test") returns True

"This is a Test".EndsWith("is") returns False


Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, 
		ByVal e As System.EventArgs) Handles Button1.Click

        Dim str As String
        str = "VB.NET TOP 10 BOOKS"
        If str.EndsWith("BOOKS") = True Then
            MsgBox("The String EndsWith 'BOOKS' ")
            MsgBox("The String does not EndsWith 'BOOKS'")
        End If

    End Sub
End Class

When you execute the program you will get a message box like "The String EndsWith 'BOOKS' " (C) 2021    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About