STR_ENDS_WITH

Use the STR_ENDS_WITH script function to check whether a certain string ends with a defined other string. For this purpose, you must specify a string that should be checked, and one that should be used for checking the required ending of the other string. Upper and lower case are considered when the strings are compared.

Syntax

STR_ENDS_WITH (String1, String2)

Parameters

  • STR_ENDS_WITH
    Checks whether a string ends with a certain other string

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

  • String2
    The string that is used for checking the ending of String1
    Format: script literal or script variable

Return codes

  • Y
    String1 ends with String2, or String1 and String2 are identical

  • N
    String1 does not end with String2


Examples

The following example script is used in a File Transfer object and checks whether the target file has the name test.txt. If so, a corresponding 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: