INDEXR

INDEXR returns an unscaled REAL FIXED BINARY value indicating the starting position within x of a substring identical to y when the search for y starts from the right end of x. You can also specify the location within x where processing begins.

Read syntax diagramSkip visual syntax diagramINDEXR( x, y, n)
The INDEXR function performs the same operation as the INDEX built-in function except for the following differences:
  • The search is done from right to left.

  • The default value of n is LENGTH(x).
  • Unless 0 ≤ n ≤ LENGTH(x), the STRINGRANGE condition, if enabled, is raised. Its implicit action and normal return give a result of zero.

The BIFPREC compiler option determines the precision of the result returned.

INDEXR will perform best when the second and third arguments are either literals, named constants declared with the VALUE attribute, or restricted expressions.