Purpose

INDEX returns the start position of one string within another string of the same type.
 

Syntax

variable = INDEX(search-string, find-string)
 

Operation

search-string is the character string to be searched.  It can be a valid alphanumeric or wide character constant, variable, or expression.
f
ind-string is the character string to be found and must be of the same type, constant, variable, or expression, as search-string
If find-string cannot be found, a value of zero is returned.
 

Remarks

The value (start position) returned is in terms of the number of bytes for alphanumeric strings, and number of characters for wide character strings.
 

Example

Assume $A = "ABC1234" and $B = "123".

#C = INDEX($A,$B)       sets #C to 4
#C = INDEX(‘D12’,$A)    sets #C to 0
 

Comment on this topic

Topic ID: 520070