STR_FIND_REVERSE

Script Function: Searches for a character or a string within a string. The search begins at the end of the string being searched.

Syntax

STR_FIND_REV[ERSE] (String1, String2)

Syntax

Description/Format

String 1, String 2

Alphanumeric string
Format: script literal or script variable


Return code

Position where the character or string was found
"0" - The character or string was not found

This script function searches for String 2 within String 1. The search is performed from the end to the beginning of the string. String2 can consist of one or several characters. The search is not case-sensitive. Upper and lower-case lettering is not taken into account. This script function returns the first position on which String 2 was found as a value. The position is then counted from the beginning of String1.

Tip: To search from a particular starting point, use STR_FIND.

Example

In the example, the search for "#" within the string "AE#01, AE#02" returns the value 10. It is then output to the activation report.

:SET &STRING#="AE#01, AE#02"
:
SET &SEARCH#="#"
:
SET &POS#=STR_FIND_REVERSE(&STRING#,&SEARCH#)
:
PRINT &POS#

In the following example, a string is searched. It is found at position 8.

:SET &POS#=STR_FIND_REV("AE#01, AE#02","AE")

:
PRINT &POS#

See also:

seealso

Script Elements for Editing Strings