Progress Monitor for IdealProgrammer.com
Take Swift, Intelligent, Massive, Planned, Loving, Effective (S.I.M.P.L.E.) Action to Transform Self into Ideal
Skip Repetitive Navigational Links
Home
News
Presenters
Register
Contact
Categories
Titles
Converter
Code Samples
C# ASP.NET
C# Console
HTML
JavaScript
SQL Server
VB ASP.NET
VB Console
Please login
VB.NET Filter()
Description:
Illustrates using VB.NET Filter() Code Example.
Example Class:
Option Compare Text Public Class clsFilter Public Sub Main() '**************************************************************************************** ' Purpose: Returns a zero-based array containing a subset of a String array based on ' specified filter criteria. ' ' Syntax: Filter (Source As String(), Match As String, Include As Boolean, _ ' Compare As CompareMethod) As String() ' ' Source - Required - one-dimensional string array to be searched ' Match - required - string to search for ' Include - optional - Boolean value indicating whether to return substrings that ' include or exclude Match. ' Compare - optional - numeric value indicating compare method - CompareMethod.Binary ' or CompareMethod.Text '**************************************************************************************** Console.WriteLine("Example #1: Filter(Source, Match, Include,Compare) As String") Dim myStrings(3) As String myStrings(0) = "This" myStrings(1) = "is" myStrings(2) = "my" myStrings(3) = "string" Dim FilteredStrings() As String FilteredStrings = Filter(myStrings, "is", True, CompareMethod.Text) For Each myItem As String In FilteredStrings Console.WriteLine(myItem) ' Returns ["This", "Is"]. Next 'write blank line to make output easier to read Console.WriteLine() 'Prevent console from closing before you press enter Console.ReadLine() End Sub End Class
Example Module:
Module Module1 Sub Main() Dim myclsFilter As New clsFilter myclsFilter.Main() End Sub End Module
Home
News
Presenters
Register
Contact
Categories
Titles
Converter
Code Samples
C# ASP.NET
C# Console
HTML
JavaScript
SQL Server
VB ASP.NET
VB Console