"Sputnik" help  
Sputnik Help
BinaryFromStr(<string>,[<type>])

Description

The BinaryFromStr function converts a string into a binary string based on the specified encoding type.

Encoding Types:

UTF7: Converts the string to a binary string using the UTF-7 encoding.
UTF8: Converts the string to a binary string using the UTF-8 encoding.
UTF16: Converts the string to a binary string using the UTF-16 encoding (Little-Endian).
UTF16B: Converts the string to a binary string using the UTF-16 encoding (Big-Endian).
UTF32: Converts the string to a binary string using the UTF-32 encoding.
SPK: Converts the string to a binary string using the same encoding that Sputnik used (UTF-8).
RAW: Treats each character in the string as a single byte (1 character = 1 byte).
ASCII: Converts the string to a binary string using the ASCII encoding.

Parameters

<string> The string to be converted to a binary string.
<type> Optional encoding type to be used for the conversion. Valid options include "UTF7", "UTF8", "UTF16", "UTF16B", "UTF32", "SPK", "RAW", and "ASCII". (Default: "RAW")

Return Value

Success: Returns the binary string representing the converted input string.
Failure: Returns an empty binary string.

Remarks

The BinaryFromStr function provides a convenient way to convert regular strings to binary strings based on different encoding types. It allows you to handle and manipulate binary data more efficiently, enabling tasks such as binary file manipulation, encoding/decoding, and data conversion. The function supports a wide range of encoding types, providing flexibility and compatibility with various data formats and protocols.

Related

BinaryToStr

Example

Example of usage:

my $a = (Binary)"Hello World!";
say BinaryToStr($a, "RAW");
printr BinaryFromStr("Cat", "RAW");
// Hello World!
// Binary
// (
//     [0] => 0x43 [67] (C)
//     [1] => 0x61 [97] (a)
//     [2] => 0x74 [116] (t)
// )

 


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