Blog

Like operator in VB.NET

Mar 24, 2011 Blogs | Visual Basic 2010
This blog defines the like operator in VB.NET.

This blog defines the like operator in VB.NET

Like operator

The Like operator is used for compare two string. If string matches pattern, result is True; if there is no match, result is False. If both string and pattern are an empty string. the result is True. Otherwise, if either string or pattern is an empty string, the result is False.

General Syntax

res = string Like pattern
res
Required. Any Boolean variable. The result is a Boolean value indicating whether or not the string matches the pattern.
string
Required. Any String expression.
pattern
Required. Any String expression conforming to the pattern-matching conventions described in Remarks.

For example

Module Module1

    Sub Main()

        Dim s As String

        s = "VB.Net"

        If s Like "?B.Net" Then

    Console.WriteLine("'VB.Net' is Like '?B.Net'")

    End Sub

End Module

 

OUTPUT

 like1.gif

Rohatash Kumar

Normal 0 false false false EN-AU X-NONE X-NONE I am a Microsoft .NET software Developer and author and C# Corner MVP. I h...

  • 6rank
  • 6M readers
  • 1times
COMMENT USING

PREMIUM SPONSORS

Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.

Latest Blogs