Open System Testing Architecture

TOC PREV NEXT INDEX



~LOCATE Command

Description:

This command is a function and can only be referenced within a SET command. It 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 a value of -1.

By default, the matching is case sensitive. The strings "London" and "LONDON", for example, would not produce a match, because the case of the characters is not the same. This can be overridden by specifying the ", CASE_BLIND" clause.

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.

Format:
 ~LOCATE (substring, string) {,CASE_BLIND}
Return Value:

The offset of the substring in the source string. If the substring was not found, then a value of -1 is returned.

Parameters:
substring

The character value defining the substring to be located in the source string. This may be a character variable or quoted character string.

string

The character value to be searched for the specified substring. This may be a character variable or quoted character string.

Example:
 SET Offset = ~LOCATE (Separator, TEST), CASE_BLIND

See also:

Output Stream Handling Commands


OpenSTA.org
Mailing Lists
Further enquiries
Documentation feedback
CYRANO.com
TOC PREV NEXT INDEX