Siebel VB Language Reference > Methods Reference for Siebel VB > String Methods >

Compare Strings Operator


The Compare Strings operator is a standard Visual Basic operator that compares the contents of two strings. It returns one of the following values:

  • -1 (TRUE). The string does match the pattern.
  • 0 (FALSE). The string does not match the pattern.

If the string argument or if the pattern argument is NULL, then it returns NULL.

The Compare Strings operator performs a comparison according to the current configuration of the Set String Comparison method. For more information, see Set String Comparison Method.

For more information about operators, see About Expressions.

Format

string LIKE pattern

The following table describes the arguments that you can use with this method.

Argument
Description

string

Any string or string expression.

pattern

Any string expression to compare to the value of the string argument.

Usage

The following table describes characters that you can use in the pattern argument.

Character
Character That the Compare Strings Operator Compares

?

A single character.

*

A set of zero or more characters.

#

A single digit character in the range of 0 through 9.

[chars]

A single character in chars.

[!chars]

A single character not in chars.

[startchar-endchar]

A single character in the range startchar through endchar.

[!startchar-endchar]

A single character not in the range startchar through endchar.

A range or list can occur in a single set of square brackets. The Compare Strings operator matches ranges according to their ANSI values. In a range, the value in startchar must be less than the value in endchar.

Example

The following example determines if a letter is lowercase:

Sub Button_Click
   Dim userstr as String
   Dim revalue as Integer
   Dim msgtext as String
   Dim pattern
   pattern = "[a-z]"
   userstr = "E"
   retvalue = userstr LIKE pattern
   If retvalue = -1 then
      msgtext = "The letter " & userstr & " is lowercase."
   Else
      msgtext = "Not a lowercase letter."
   End If
End Sub

Siebel VB Language Reference Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.