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

STR_FIND

Script Function: It searches for a character or a string in a string.

Syntax

STR_FIND(String1, String2, [Start])

Syntax

Description/Format

String1

An alphanumeric string in which the search should take place.
Format: script literal or script variable

String2

An individual character or alphanumeric string that is searched.
Format: script literal or script variable

Start

The position where a search should begin.
Format: Number without quotation marks
Default value: 1


Return codes

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

Comments

The function STR_FIND looks for String2 in String1 beginning at position Start. If Start is not specified, the search begins at position 1. String2 can consist of one character. The search is not case sensitive.

The script function returns the first position where String2 has been found. The position is counted from the beginning of String1, not from the position specified by Start.

Examples

In the example, the search for "#" in the string "Automic#01, Automic#02" returns the value 8.

:SET &STRING#="Automic#01, Automic#02"
:
SET &SEARCHSTRING#="#"
:
SET &POS#=STR_FIND(&STRING#,&SEARCHSTRING#)
:
PRINT &POS#

In the following example, the search starts at position 2. Hence, the position where the string is found is 13.

:SET &POS#=STR_FIND("AUTOMIC#01, AUTOMIC#02","AUTOMIC", 2)

:PRINT &POS#

 

See also:

Script element Description

STR_FIND_REVERSE

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

Script Elements - Strings

Sample Collection
Notification with variable Message Text

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by function