strFind function


strFind Integer

strFind (String input, String findstring)

Performs a case sensitive search in the input string for the find string. The index in the input string where the find string is returned if found, -1 if the findstring was not found.

Parameters:

input - string to examine

findstring - string to look for

Returns:

Integer containing the index where the findstring was found. -1 is returned if the findstring was not found.

Example

str = 'This is an example string'
idx1 = strFind(str, 'example')
// idx1 is 8
idx2 = strFind(str, 'not there')
// idx2 is -1

Example

//
// Trigger on the string 'IEE136I' (the message id for the 'D T' output)
// anywhere in the string
// trigger on strFind(message.TEXT, 'IEE136I') >= 0 //
// Rest of the rule follows.

 

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