STR_ENDS_WITH

Script Function: Checks whether a string ends with a certain other string.

Syntax

STR_ENDS_WITH (String1, String2)

Syntax

Description/Format

String1

The string that should be checked.
Format: script literal or script variable

String2 The string that is used for checking string1.

Format: script literal or script variable

Return Codes

"Y" = String1 ends with string2
"N" = String1 does not end with string2.

Comments

This script element checks whether the end of a certain string complies with another string. Note that you must specify the string that should be checked (parameter String1) and the string that should be used for checking the required ending (String2).

This script function will also supply "Y" when String1 and String2 are identical.

Note that this comparison is case sensitive.

Examples

The following example script is used in a FileTransfer object and checks whether the target file has the name "test.txt". If so, a message is written to the activation report.

:SET &DST# = GET_ATT(FT_DST_FILE)
:SET &VAR# = STR_LC(&DST#)
:SET &CHECK# = STR_ENDS_WITH(&VAR#,"test.txt")
:IF &CHECK# EQ "Y"
P "Target file= test.txt"
:ENDIF

See also:

Script Elements Description

STR_STARTS_WITH

Checks whether a string starts with a certain other string.