Important This documentation space contains information about PATROL Agents when deployed in a TrueSight Operations Management environment. If you are a BMC Helix Operations Management user, see PATROL Agent for BMC Helix Operations Management 24.2.

index()


Return the starting position of one string within another.

Syntax

index(text,string)

Parameter

Parameter

Definition

text

text to be searched for the occurrence of string The text can be a text string enclosed in double quotation marks, or one or more PSL commands that produce text as output.

string

one or more characters enclosed in double quotation marks that are to be located within text.

Description

The index() function returns the position (indicated as an integer) in text at which string begins, or 0 if string does not occur in text. The first position in text is position 1.

Example

The following PSL statement uses the index() function to find the position of one string within another:

sentence = "The quick red fox jumped over the lazy brown dogs";
animal = "fox";
print(index(sentence,animal));

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*