INDEX function
Returns an INTEGER value that indicates the position of the target string within the source string.
Syntax
source
target
A CHARACTER or LONGCHAR expression whose position you want to locate in source
. If target
does not exist within source
, INDEX returns a 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".
This procedure also uses the starting
option:
Notes
- If either operand is case sensitive, then the search is case sensitive.
- If the target string is null, the result is 0.
- The INDEX function is double-byte enabled. You can specify
target
and source
strings for the INDEX function that contain double-byte characters.
See also
LOOKUP function, R-INDEX function