- How to compare strings using LIKE
  - The Program
  - The Code:
  - The Source

# How to compare strings using LIKE

With the LIKE operator you can compare a string to a pattern with wildcards.
Syntax: String LIKE pattern
If String matches pattern, Like returns TRUE.

## The Program

Type a pattern in the textbox and click the button - see what happens ;-)
You can use the following generic characters:
*, ?, [x y], [^x y], \ (see the LIKE page)

## The Code:

    STATIC PUBLIC SUB Main()
      hForm AS Fmain
      hForm = NEW Fmain
      hForm.show
    END

    PUBLIC SUB Button1_Click()
      IF Label1.Text LIKE TextBox1.Text THEN
        TextLabel1.Text = TextBox1.Text & " matches!"
      ELSE
        TextLabel1.Text = TextBox1.Text & " does not match!"
      ENDIF
    END

## The Source

Download