Core Function BinaryPop

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> BinaryPop( <binary-array> ) </pre> === Description === Delete the last byte from a binary variable. === Parameters === ==== binary-array ==== The binary variable to u...")
 
(Example)
Line 26: Line 26:
  
 
<syntaxhighlight lang="sputnik">
 
<syntaxhighlight lang="sputnik">
$binary = Pack("z0", "1234")
+
$binary = Pack("z0", "1234");
println( "'" . Unpack("z0", $binary) . "'" ) ; Prints: 1234
+
println( "'" . Unpack("z0", $binary) . "'" ); // Prints: 1234
BinaryPop($binary)
+
BinaryPop($binary);
println( "'" . Unpack("z0", $binary) . "'" ) ; Prints: 123
+
println( "'" . Unpack("z0", $binary) . "'" ); // Prints: 123
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
[[Category:Core Function]]
 
[[Category:Core Function]]

Revision as of 17:58, 19 November 2011

BinaryPop( <binary-array> ) 

Contents

Description

Delete the last 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 its best to avoid using this too often.

Example

$binary = Pack("z0", "1234");
println( "'" . Unpack("z0", $binary) . "'" ); // Prints: 1234
BinaryPop($binary);
println( "'" . Unpack("z0", $binary) . "'" ); // Prints: 123
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox