"Sputnik" help  
Sputnik Help
BinCmp(<binary1>, <binary2>, [<position1>], [<position2>], [<count1>], [<count2>])

Description

Compares two binary strings, <binary1> and <binary2>, based on the specified positions and lengths. The BinCmp function performs a binary comparison of the specified portions of the binary strings.

Parameters

<binary1> The first binary string to compare.
<binary2> The second binary string to compare.
<position1> Optional starting position in <binary1> for the comparison. If not specified, the comparison starts from the beginning of <binary1>.
<position2> Optional starting position in <binary2> for the comparison. If not specified, the comparison starts from the beginning of <binary2>.
<count1> Optional number of bytes to compare from <binary1>. If not specified, the comparison includes the entire <binary1>.
<count2> Optional number of bytes to compare from <binary2>. If not specified, the comparison includes the entire <binary2>.

Return Value

Success: Returns a zero integer (0).
Failure: Returns a negative or positive integer.

Remarks

The BinCmp function performs a binary comparison between two binary strings, allowing you to compare specific portions of the strings. By specifying the positions and lengths, you can control which parts of the binary strings are compared. If the optional parameters are not provided, the function performs the comparison on the entire binary strings.

Related

BinCaseCmp, BinNCmp, BinNCaseCmp

Example

Example of usage:

say BinCmp(Bin("Hello"), Bin("Hello")); // true
say BinCmp(Bin("Hello"), Bin("HELLO")); // false
say BinCaseCmp(Bin("Hello"), Bin("HELLO")); // true
say BinNCmp(Bin("CatDog"), Bin("CatFox"), 3); // true
say BinNCmp(Bin("CatDog"), Bin("CATFox"), 3); // false
say BinNCaseCmp(Bin("CatDog"), Bin("CATFox"), 3); // true
// PRINTS
// 0
// 32
// 0
// 0
// 32
// 0

 


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org