Mega Code Archive

 
Categories / VB.Net Tutorial / Data Type
 

EndsWith method

Imports System Public Class EndsWithTest     Public Shared Sub Main()         Dim strSource As String() = { "<b>This is bold text</b>","wrong>"}         Dim s As String         For Each s In  strSource             Console.WriteLine(StripEndTags(s))         Next s     End Sub     Private Shared Function StripEndTags(item As String) As String         If item.Trim().EndsWith(">") Then             Dim lastLocation As Integer = item.LastIndexOf("</")             If lastLocation >= 0 Then                 item = item.Substring(0, lastLocation)             End If         End If     Return Item     End Function End Class