Searches for an element that matches the conditions
Imports System
Public Class Example
Public Shared Sub Main()
Dim numbers() As String = { "Five", "Two","One","Ten","Seven","Twenty","Zero","Last" }
For Each num As String In numbers
Console.WriteLine(num)
Next
Console.WriteLine(Array.FindIndex(numbers, AddressOf EndsWithT))
Console.WriteLine(Array.FindIndex(numbers, 2, AddressOf EndsWithT))
Console.WriteLine(Array.FindIndex(numbers, 2, 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