Core Function BinaryCompare

From Sputnik Wiki
Revision as of 13:45, 27 September 2013 by UberFoX (Talk | contribs)
Jump to: navigation, search
BinaryCompare( <binary-array>, <binary-array2>, <length> )

Contents

Description

Compare two binary variables.

Parameters

binary-array

The a binary variable to use.

binary-array2

The a binary variable to use.

length

Optional; Maximal number of bytes to compare.

Default: Length of the smallest array

If you enter a number too high it will be shortened to smallest array

If you enter under zero it will change to zero

If zero is the length it will do a compare as if you had ignored this parameter

Return Value

-1 if binary1 is less than binary2

1 if binary1 is greater than binary2

0 if they are equal.

-2 on error

Remarks

None.

Example

my $Binary1 = Pack("A*", "Hello world!!!");
my $Binary2 = Pack("A*", "Hello world!!!");
 
If( BinaryCompare($Binary1, $Binary2) == 0 )
{
	println("Both binary variables contain the same data");
}
Else
{
	println("No match");
}
 
println("");
println("Lets try again now now that one was changed");
my $Binary1 = Pack("A*", "Test");
If( BinaryCompare($Binary1, $Binary2) == 0 )
{
	println("Both binary variables contain the same data");
}
Else
{
	println("No match");
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox