checkPattern()

Compares a bit32/bit64 variable with a pattern.

Synopsis

int checkPattern(bit32 aBitVar, string pattern);

int checkPattern(bit64 aBitVar, string pattern);

Parameters

Parameter Meaning
aBitVar Bit variable
pattern Pattern

Return Value

If there is a match, 1 is returned, otherwise 0. In the event of an error -1.

Description

Returns whether aBitVar matches the pattern "pattern". The pattern length is 1-64 characters. Only the characters "0" and "1" are accepted, all others are ignored! For example the interpretation of the pattern strings: "1011x01" means, bit 2 is ignored, bit 0, 1, 3, 4, 5, 6 have to fit.

Pattern Comment
0 aBitVar must contain 0 at the appropriate position
1 aBitVar must contain 1 at the appropriate position

Example

main()
{
  bit32 b;
  b = 13;
  DebugN(checkPattern(b,"1101"));
// Returns 1
}

Assignment

Functions for bit32/bit64 variables

Availability

CTRL