Find Function

Description:

This function returns an integer value corresponding to the offset of the specified substring in the source string. The offset of the first character in the source string is zero. If the substring is not found, the function returns -1.

Format:

result = Find(input_string, search_string)
result = Find(input_string, search_string, offset)
result = Find(input_string, search_string, options)
result = Find(input_string, search_string, offset, options)

If the offset does not lie within the boundaries of the source string, the result -1.
By default, the matching is case sensitive. The strings "London" and "LONDON", for example, would not produce a match. This can be overridden by specifying the NOCASE option (see below).
The source string is scanned from left to right. If the substring appears more than once in the source string, the function will always return the offset of the first occurrence.

Parameter:

input_string

A string expression to be searched for the specified substring.

search_string

A string expression defining the substring to be located in the source string.

offset

An integer expression from which the substring is to be located.

options

Available options are:
 

NOCASE  Performs a case insensitive search 

Example:

integer iPos;

iPos = FIND("Find a word in this string", "A Word", nocase);
LOG "Position = " + ToString(iPos);

Output:

Position = 5





Go back to the Learning center:


Copyright © AgileLoad. All rights reserved.
Agile Load testing tool| Contact AgileLoad | Terms of Use | Sitemap