Automation Engine Script Guide > Ordered by Function > Strings > STR_FIND_REVERSE

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

Comments

This script function searches for String 2 within String 1. As opposed to the script function STR_FIND, String 1 is search through from the end to the beginning.

String2 can consist 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.

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 protocol.

: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:

Script element Description

STR_FIND

Searches for a character or a string in a string

Script Elements - Strings

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function