Core Function BinaryStripNull

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> BinaryStripNull( <binary-array> ) </pre> === Description === Strip all NULL bytes (0x00) from a binary variable. === Parameters === ==== <binary-array> ==== The binary...")
 
m (1 revision)
 
(3 intermediate revisions by one user not shown)
Line 21: Line 21:
 
=== Remarks ===
 
=== Remarks ===
  
None.
+
If this binary variable had a text encoding stored it will now be wiped.
  
 
=== Example ===
 
=== Example ===
Line 32: Line 32:
 
BinaryStripNull($a);
 
BinaryStripNull($a);
 
printr $a;
 
printr $a;
// Prints
+
# Prints
 
# {BINARY:6}
 
# {BINARY:6}
 
# {
 
# {

Latest revision as of 12:37, 14 June 2015

BinaryStripNull( <binary-array> )

Contents

Description

Strip all NULL bytes (0x00) from a binary variable.

Parameters

<binary-array>

The binary variable to use.

Return Value

Success: Returns amount of nulls removed.

Failure: Returns 0.

Remarks

If this binary variable had a text encoding stored it will now be wiped.

Example

$a = BinaryCreate(6);
$a[0] = 'T';
$a[2] = 'A';
printr $a;
BinaryStripNull($a);
printr $a;
# Prints
# {BINARY:6}
# {
#         [0] => 84
#         [1] => 0
#         [2] => 65
#         [3] => 0
#         [4] => 0
#         [5] => 0
# }
# {BINARY:2}
# {
#         [0] => 84
#         [1] => 65
# }
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox