Monday 29 August 2011

Match a pattern from user input

Public Class PatternMatcher
    Shared Sub Main()
        Dim sInput As String
        Dim sPattern As String
        Dim sMatch As String

        System.Console.Write("Please Enter A Pattern:")
        sInput = System.Console.ReadLine()
        sPattern = sInput

        System.Console.Write("Please Enter A String To Compare Against:")
        sInput = System.Console.ReadLine()
        sMatch = sInput

        If sMatch Like sPattern Then
            System.Console.WriteLine(sMatch & " Matched with " & sPattern)
        Else
            System.Console.WriteLine(sMatch & " did not Match with " & sPattern)
        End If
    End Sub
End Class

No comments:

Post a Comment