LIKE

Boolean = String LIKE Pattern

Returns TRUE if String matches Pattern. The pattern can contain the following generic characters :


Generic character Matches
* Any number of any character.
? Any single character.
[abc] Any character between the brackets.
[x-y] Any character in the interval.
[^x-y] Any character not in the interval.

The special generic character \ prevents its following character to be interpreted as generic.


Example

PRINT "Gambas" LIKE "G*"

TRUE

PRINT "Gambas" LIKE "?[Aa]*"

TRUE

PRINT "Gambas" LIKE "G[Aa]\\*"

FALSE

Note: you must double the backslash character, otherwise \* will be interpreted by the compiler as a special character like \n, \t, ...

Or you can use this pattern string: LIKE "G[Aa][*]"

PRINT "Gambas" LIKE "G[^Aa]*"

FALSE


See Also

InStr, Len, Left$, Mid$, Right$


Previous: Len Next: LINE INPUT