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
Required. Any Boolean variable. The result is a Boolean value indicating whether or not the string matches the pattern.
Required. Any String expression.
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





Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now