Navigation:  ThinBASIC Modules > Core (thinBasic Core Engine) > String functions >

IsLike

Previous pageReturn to chapter overviewNext page

 

Description

 

Used to compare a source string with a string pattern returning %TRUE or %FALSE on similarity.

 

Syntax

 

n = IsLike(StringToCompare, StringPattern, CaseSensitive)

 

 

Returns

 

Number

 

Parameters

 

Name

Type

Optional

Meaning

StringToCompare

String

No

String to be checked

StringPattern

String

No

Expression pattern. Wildcard supported expression pattern:

 

Char

Meaning

?

Any single character

*

Zero or more characters

#

Any single digit (0-9)

[charlist]

Any single character in 'charlist'

[!charlist]

Any single character not in 'charlist'

 

CaseSensitive

Number

No

%TRUE or %FALSE if comparison has to consider letter case.

 

Remarks

 

Restrictions

 

See also

 

Examples

 

Script example

'---Set a checking variable

Dim lCheck As Long

 

'---Perform comparison.

'---We are checking if string starts with 3 chars (any)

'---followed by 5 numbers followed by whatever.

lCheck = IsLike("ABC1234567._extb""???#####*"%False)

 

'---Show result

MSGBOX 0, "IsLike returned " & lCheck