"Sputnik" help  
Sputnik Help
BinaryConcat(<binary>, <value/s>, [<separator>])

Description

Concatenates binary data with other binary values or arrays of binary values in place.

Parameters

<binary> The binary data to be concatenated.
<value> The binary value(s) or array of binary values to be concatenated with the <binary>
<separator> The separator to be used when concatenating multiple values. (Default: Empty binary string)

Return Value

Success: Returns true.
Failure: Returns false.

Remarks

The BinaryConcat function takes the binary and concatenates it with other binary values or arrays of binary values in place. If the values parameter is a binary value, it is directly concatenated with the binary. If the values parameter is an array of binary values, all the values in the array are concatenated with the binary. Optionally, a separator can be specified to separate the concatenated values. The separator parameter is an optional parameter, and if not provided, an empty binary string is used as the separator.

The concatenation happens in place, meaning the binary variable is modified directly.

If the function encounters an error or the provided parameters are incorrect, it returns false indicating that the concatenation failed.

Related

BinaryAppend, BinaryJoin

Example

Basic example:

my $binary = bin("Hello");
BinaryConcat($binary, array(bin("Cat"), bin("Dog")));
BinaryExpandPrintLn($binary, false);
// PRINTS
// 48 65 6C 6C 6F 43 61 74 44 6F 67 -- -- -- -- -- HelloCatDog

Example using the separator and an array of values:

my $binary = bin("Hello");
BinaryConcat($binary, array(bin("Cat"), bin("Dog")), bin("-"));
BinaryExpandPrintLn($binary, false);
// PRINTS
// 48 65 6C 6C 6F 2D 43 61 74 2D 44 6F 67 -- -- -- Hello-Cat-Dog

 


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