Script Function: Compares two strings
STR_MATCH(String1, String2, [Wildcard1], [Wildcard2])
Syntax |
Description/Format |
---|---|
String1 |
Alphanumeric character string which should be compared |
String2 |
Alphanumeric character string which should be compared |
Wildcard1 |
Character representing any character |
Wildcard2 |
Character representing one character |
Return code |
---|
"Y" - The two strings
are 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.
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#,"")
The first example shows the output of the result "N" in the activation protocol.
:SET &RET# = STR_MATCH("UserInterface", "User-Interface")
:PRINT &RET#
The second example uses a wildcard character for comparison. The result "Y" is output in the activation protocol.
:SET &RET# = STR_MATCH("UserInterface",
"U*I*")
:PRINT &RET#
The third example uses a wildcard character which is explicitly specified. The result "Y" is output in the activation protocol.
:SET &RET# = STR_MATCH("UserInterface", "User#", "#")
:PRINT &RET#
The fourth example also includes a wildcard character. It stands for exactly one character. Therefore, the result is "N".
:SET &RET# = STR_MATCH("UserInterface", "User#",, "#")
:PRINT &RET#
See also:
Script Elements -
Strings
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function