Net-informations.com
SiteMap  | About    

How to VB.NET String.EndsWith()



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

Parameters:

  1. suffix - The passing String for it EndsWith .

Returns:

  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

Exceptions:






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' ")
        Else
            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' "





net-informations.com (C) 2019    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.