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

Description

Converts a binary string to its hexadecimal representation.

Parameters

<binary> The binary string to be converted.

Return Value

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

Remarks

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

Related

Hex2Bin

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