Skip to main content

$ZBITFIND (legacy function)

Bitstring function – FIND.

Synopsis

$ZBITFIND(bitstring, truthval, position)

Parameters

Argument Description
bitstring A bitstring.
truthval Binary value (0 or 1).
position Optional — Specifies a starting bit position in bitstring.

Description

This page describes the legacy function $ZBITFIND. It is described here for compatibility with legacy applications.

$ZBITFIND returns the position immediately after the first bit in bitstring that equals truthval. position specifies an optional starting position for the search. If position is omitted, the search starts at position 1.

If truthval is not found, $ZBITFIND returns zero.

$ZBITFIND is similar to the $FIND function in that the returned position is the next one after the matching bit. This permits a loop of the form:

Findabit
  FOR p=1:0 {
      SET p=$ZBITFIND(bstring,1,p) 
      QUIT:´p 
      DO Foundone
   }
Foundone

Parameters

truthval

Binary value (0 or 1).

position

Specifies a starting bit position in bitstring. The default is 1. Bits are counted left-to-right, with the first bit counted as number 1.

Examples

Note that the result is the position immediately after the bit that matches truthval.

Given the bitstring[0,0,1,1,0]:

If truthval=0 then the result of $ZBITFIND would be position 2.

If truthval=1 then the result of $ZBITFIND would be position 4.

If truthval=0 and position=2, then the result of $ZBITFIND would be position 3.

If truthval=0 and position=3, then the result of $ZBITFIND would be position 6.

See Also

FeedbackOpens in a new tab