STRING.getIndexOf

Returns the position of a sub-string.

Syntax

getIndexOf( string STRING, start INTEGER )
       RETURNING result INTEGER
  1. string is the sub-string to be searched.
  2. start 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 substring was not found.
  • The variable is NULL.
  • The 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 semantincs, it is specified in characters.

Example

MAIN
  DEFINE s STRING
  LET s = "Some text"
  DISPLAY s.getIndexOf("text",1)
END MAIN