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

System.String.EndsWith(String suffix) as Boolean

Parameters:

suffix - The passing String for it EndsWith

Returns:

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:

System.ArgumentNullException : If the argument is null




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) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.