Array.FindLastIndex
Imports System
Public Class Example
Public Shared Sub Main()
Dim numbers() As String = { "Five","Two","Ten","Thirth","Four","One","Zero","Twenty" }
For Each num As String In numbers
Console.WriteLine(num)
Next
Console.WriteLine(Array.FindLastIndex(numbers, AddressOf EndsWithT))
Console.WriteLine(Array.FindLastIndex(numbers, 4, AddressOf EndsWithT))
Console.WriteLine(Array.FindLastIndex(numbers, 4, 3, AddressOf EndsWithT))
End Sub
Private Shared Function EndsWithT(ByVal s As String) As Boolean
If s.Substring(s.Length-2,s.Length - 1).ToLower() = "t" Then
Return True
Else
Return False
End If
End Function
End Class
Related examples in the same category