Core Function BinaryShift
From Sputnik Wiki
(Difference between revisions)
(→Example) |
|||
Line 26: | Line 26: | ||
<syntaxhighlight lang="sputnik"> | <syntaxhighlight lang="sputnik"> | ||
− | $binary = Pack(" | + | $binary = Pack("A*", "1234"); |
− | println( "'" . Unpack(" | + | println( "'" . Unpack("A*", $binary, 3) . "'" ); // Prints: 1234 |
BinaryShift($binary); | BinaryShift($binary); | ||
− | println( "'" . Unpack(" | + | println( "'" . Unpack("A*", $binary, 3) . "'" ); // Prints: 234 |
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category:Core Function]] | [[Category:Core Function]] |
Revision as of 16:36, 27 September 2013
BinaryShift( <binary-array> )
Contents |
Description
Delete the first byte from a binary variable.
Parameters
binary-array
The binary variable to use.
Return Value
Success: Returns 1.
Failure: Returns 0.
Remarks
Binary data is not really meant to be resized like crazy, so if you have a LOT of data, it is best to avoid using this too often.
Example
$binary = Pack("A*", "1234"); println( "'" . Unpack("A*", $binary, 3) . "'" ); // Prints: 1234 BinaryShift($binary); println( "'" . Unpack("A*", $binary, 3) . "'" ); // Prints: 234