Blog

Like operator in VB.NET

Posted by Rohatash Kumar Blogs | Visual Basic 2010 Mar 24, 2011
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

COMMENT USING
PREMIUM SPONSORS
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.
SPONSORED BY
  • MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.