Match a pattern from user input : Console Read « Language Basics « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » Language Basics » Console Read 
1.3.8.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
Please Enter A Pattern:*
Please Enter A String To Compare Against:123
123 Matched with *
1.3.Console Read
1.3.1.Read a single character
1.3.2.Read a complete line of text
1.3.3.Read a string from console
1.3.4.Read keyboard input
1.3.5.Use Do Loop to read user input
1.3.6.Convert what you type to value type
1.3.7.Use While to read user input
1.3.8.Match a pattern from user input
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.