$ZFind()

Returns an integer byte position that locates the occurrence of a byte sequence within a sequence of octets(8-bit bytes).

The format of the $ZFIND function is:

$ZF[IND](expr1,expr2[,intexpr])

Examples

Example:

GTM>write $zfind("主要雨",$zchar(187))
4
GTM>

This example uses $ZFIND() to WRITE the position of the first occurrence of the numeric byte code 150. The return of 3 gives the position after the "found" byte.

Example:

GTM>write $zfind("新年好",$zchar(229),5)
8
GTM>

This example uses $ZFIND() to WRITE the position of the next occurrence of the byte code 229 starting in byte position five.

Example:

GTM>set t=1 for  set t=$zfind("新年好",$zchar(230,150,176),t) quit:'t  write !,t
4
GTM>

This example uses a loop with $ZFIND() to locate all the occurrences of the byte sequence $ZCHAR(230,150,176) in the sequence of octets ("新年好"). The $ZFIND() returns 4 giving the position after the occurrence of byte sequence $ZCHAR(230,150,176).