Skip to Content
VB.NET Language in a Nutshell, Second Edition
book

VB.NET Language in a Nutshell, Second Edition

by Steven Roman PhD, Ron Petrusha, Paul Lomax
April 2002
Intermediate to advanced
688 pages
19h 51m
English
O'Reilly Media, Inc.
Content preview from VB.NET Language in a Nutshell, Second Edition

Name

Like Operator

Syntax

                  result = string Like pattern
string (required; String)

The string to be tested against pattern

pattern (required; String)

A series of characters used by the Like operator to determine if string and pattern match

Return Type

Boolean

Description

If string matches pattern, result is True; otherwise, result is False.

Rules at a Glance

  • If either string or pattern is Nothing, then result will be Nothing.

  • The default comparison method for the Like operator is Binary. This can be overridden using the Option Compare statement.

  • Binary comparison is based on comparing the internal binary number representing each character; this produces a case-sensitive comparison.

  • Text comparison, the alternative to binary comparison, is case insensitive; therefore, A = a.

  • The sort order is based on the code page currently being used, as determined by the Windows regional settings.

  • The following table describes the special characters to use when creating a pattern; all other characters match themselves.

Character

Meaning

?

Any single character

*

Zero or more characters

#

Any single digit (0-9)

[list]

Any single character in list

[!list]

Any single character not in list

[]

A zero-length string (“”)

  • list is used to match a group of characters in pattern to a single character in string and can contain almost all available characters, including digits.

  • Use a hyphen (-) in list to create a range of characters to match a character in string. For example, [A-D] will match A, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

VB .NET Language in a Nutshell

VB .NET Language in a Nutshell

Steven Roman PhD, Ron Petrusha, Paul Lomax

Publisher Resources

ISBN: 0596003080Supplemental ContentCatalog PageErrata