Core Function BinaryConcat
From Sputnik Wiki
BinaryConcat( <destination/array>, <values> )
Contents |
Description
Mass append a ton of Binary variables in an extremely fast and efficient way.
Parameters
destination/array
IF this param is NOT an array then it expects a binary variable or something it can as such.
IF this param IS an array then the element [0] must be a reference to a binary variable and [1] must be the separator as a binary variable or something that can be converted to it.
values
One of more values to be concatenated.
Return Value
Success: Returns true.
Failure: Returns false.
Remarks
None.
Example
// Make a binary var we will concat onto it my $a = Pack("A*", "Hello"); // Make binary stuff to concat to it my $b = Pack("A*", "Hehe"); my $c = Pack("A*", "Test"); my $d = Pack("A*", "Cat"); my $e = Pack("A*", "Dog"); // Do the concat BinaryConcat($a, $b, $c, $d, $e); say $a; // PRINTS // HelloHeheTestCatDog
Using the separator to do that we must use an array with first element referenced using &
// Make a binary var we will concat onto it my $a = Pack("A*", "Hello"); // Make a binary var we will use as the separator my $sep = Pack("A*", ", "); // Make binary stuff to concat to it my $b = Pack("A*", "Hehe"); my $c = Pack("A*", "Test"); my $d = Pack("A*", "Cat"); my $e = Pack("A*", "Dog"); // Do the concat BinaryConcat(array(&$a, $sep), $b, $c, $d, $e); say $a; // PRINTS // Hello, Hehe, Test, Cat, Dog