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

Description

Compares a specified number of bytes (<length>) from two binary strings (<binary1> and <binary2>) starting from the specified positions (<position1> and <position2>) with the specified lengths (<count1> and <count2>). The BinNCmp 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.
<length> The number of bytes to compare from both binary strings.
<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 BinNCmp function performs a binary comparison between two binary strings, allowing you to compare a specific number of bytes from the specified positions. By specifying the lengths, you can control the number of bytes to compare from each binary string. If the optional parameters are not provided, the function includes the entire binary strings from the specified positions.

Related

BinCmp, BinCaseCmp, 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