INDEX function
- Last Updated: February 11, 2026
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
Returns an INTEGER value that indicates the position of a search string within a source string.
Syntax
|
- source
- A CHARACTER, LONGCHAR or MEMPTR expression.
- searchString
- A CHARACTER or LONGCHAR expression whose position you want to locate
in source. If searchString does not exist within source,
INDEXreturns 0. - starting
- An integer that specifies at which left-most position in the string to
start the search. For example,
INDEX("abcdefabcdef","abc",6)returns 7.
Examples
For this example, you must enter 1, 2, 3, 4, or 5. The INDEX function checks if the digit exists in the string
"12345".
r-index.p
|
This procedure also uses the starting option:
r-index2.p
|
The following example demonstrates using the INDEX function on a MEMPTR variable:
|
Notes
- If source is a CHARACTER or LONGCHAR expression and either operand is case sensitive, the search is case sensitive.
- If source is a MEMPTR, case sensitivity depends on the searchString. If searchString is case sensitive, the search is case sensitive.
- If searchString is an empty string
(
"") or a null string ("?"), the function returns 0.