isLike Method

Class: String

Description

This method indicates whether the string satisfies a certain pattern. The pattern is specified as an SQL LIKE predicate. The current version of PSL supports the following likePatterns:

Syntax

StringObject.isLike(String likePattern,Boolean ignoreCase)

Parameters

likePattern

The pattern to test. You may include the SQL wild card character % to denote zero or more characters.

ignoreCase

An option that indicates whether to ignore case. Valid values are 1 (ignore case) and 0 (do not ignore case).

Returns

True, if the string satisfies the pattern.

False, if the string does not satisfy the pattern.

When Became Available

v7.0

Example

// the example string

type String STR = "Be free, fly far away"

 

type Boolean YES = STR.isLike("%fly%")

set YES = STR.isLike("be%",1)        // case insensitive

set YES = STR.isLike("%away",0)

set YES = STR.isLike("BE FREE, FLY FAR AWAY",1)

 

type Boolean NO = STR.isLike("be%") // case sensitive

set NO = STR.isLike("%flee%")