STR_MATCH

Script Function: Compares two strings

Syntax

STR_MATCH (String1, String2[, Wildcard1[, Wildcard2]])

Syntax

Description/Format

String1

Alphanumeric character string which should be compared
Format: script literal or script variable

String2

Alphanumeric character string which should be compared
Format: script literal or script variable  

Wildcard1

Character representing any character
Format: script literal or script variable
Default: "*"

Wildcard2

Character representing one character
Format: script literal or script variable
Default: "_"


Return code

"Y" - The two strings are identical
"N" - The two strings are not identical

This script function checks if String2 is identical String1. Upper and lower case are distinguished (case-sensitive).

In String2 wildcard characters may be used to form a comparison pattern. Generally "*" stands for any character and "_" for exactly one.

Other wildcard characters may be used and assigned to Wildcard1 and/or Wildcard2.

Warning! As of v11 of the Automation Engine the length of variables was changed.
Thus, if a variable contains a blank, the check for a variable of length 0 will return the value "N", as this example would produce:

:SET &TEST# = GET_VAR(‚VARA.TEST‘,‘KEY_DOES_NOT_EXIST‘)
:SET &TRUE# = STR_MATCH(&TEST#,"")

Examples

The sample strings below are not the same, so this script yields a negative return code (N).

:SET &COMPARISON# = STR_MATCH("AE", "global")

The following example uses a wildcard character for comparison. The strings match, so the positive result (Y) is printed in the activation report.

:SET &RET# = STR_MATCH("PromptSet", "P*S*")
:
PRINT &RET#

The following example uses a wildcard character which is explicitly specified. The strings match, so the positive result (Y) is printed in the activation report.

:SET &RET# = STR_MATCH("PromptSet", "Prompt#", "#")
:
PRINT &RET#

The following example includes a wildcard character which stands for exactly one character. IN this case, the strings do not match so the negative result (N) is printed in the activation report.

:SET &RET# = STR_MATCH("PromptSet", "Prompt#",, "#")
:
PRINT &RET#

See also: