STRING.getIndexOf
Returns the position of a sub-string.
Syntax
getIndexOf(
str STRING,
startIndex INTEGER )
RETURNS INTEGER
- str is the sub-string to be searched.
- startIndex is the starting position for the search.
Usage
This method scans a STRING
variable to find the
sub-string passed as parameter, and returns the position of the sub-string.
The method starts to search the sub-string at the starting position specified as second parameter.
The method returns zero if:
- The
STRING
variable isNULL
. - The str sub-string was not found.
- The str sub-string is
NULL
. - The start position is out of bounds.
Important: When using byte length semantics, the position is
expressed in bytes, and when using char length semantics, it is specified
in characters.
Example
MAIN
DEFINE s STRING
LET s = "Some text"
DISPLAY s.getIndexOf("text",1)
END MAIN