"Sputnik" help  
Sputnik Help
Hex2Bin(<binary>)

Description

Converts a hexadecimal string to its binary representation.

Parameters

<string> The hexadecimal string to be converted.

Return Value

Success: Returns the binary representation as a string.
Failure: Returns an empty string.

Remarks

The Hex2Bin function is used to convert a hexadecimal string to its equivalent binary representation.

Related

Bin2Hex

Example

Example of usage:

my $bin = (binary)"Hello";
my $hex = Bin2Hex($bin);
my $newBin = Hex2Bin($hex);
say "OrigBin:";
printrd $bin;
say "\nHex:";
printrd $hex;
say "\nNewBin:";
printrd $newBin;

// OrigBin:
// binary(5) {
//   [0]=> byte(0x48 [72] (H))
//   [1]=> byte(0x65 [101] (e))
//   [2]=> byte(0x6C [108] (l))
//   [3]=> byte(0x6C [108] (l))
//   [4]=> byte(0x6F [111] (o))
// }
// 
// Hex:
// string(10) "48656c6c6f"
// 
// NewBin:
// binary(5) {
//   [0]=> byte(0x48 [72] (H))
//   [1]=> byte(0x65 [101] (e))
//   [2]=> byte(0x6C [108] (l))
//   [3]=> byte(0x6C [108] (l))
//   [4]=> byte(0x6F [111] (o))
// }

 


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