Imports System
Public Class Example
Public Shared Sub Main()
Dim letters() As String = { "E", "B", "A", "Z", "D", "X", "Y","Q" }
Dim subArray() As String = Array.FindAll(letters, AddressOf EndsWithS)
For Each letter As String In subArray
Console.WriteLine(letter)
Next
End Sub
Private Shared Function EndsWithS(ByVal s As String) As Boolean
If (s.Length > 5) AndAlso (s.Substring(s.Length - 6).ToLower() = "S") Then
Return True
Else
Return False
End If
End Function
End Class
|