Core Function BinaryFromStr

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Example)
Line 1: Line 1:
 
<pre>
 
<pre>
BinaryFromStr( <string> )
+
BinaryFromStr( <string>, <flag> )
 
</pre>
 
</pre>
  
Line 12: Line 12:
  
 
The string to use.  
 
The string to use.  
 +
 +
==== flag ====
 +
 +
Optional; Encoding to use.
 +
 +
Choices are:
 +
 +
"ASCII" = Each byte will directly be converted to a single character and returned as a string
 +
 +
"UTF8" = Similar to ASCII but uses 2 bytes of one for each character of the string it will make
 +
 +
"UNICODE" = Alias to UTF8 (or whatever Sputnik is using for Unicode strings)
 +
 +
Some more options (Unlikely to be used)
 +
 +
"UTF7"
 +
 +
"UTF32"
 +
 +
Default: "ASCII"
  
 
=== Return Value ===
 
=== Return Value ===

Revision as of 15:37, 26 September 2013

BinaryFromStr( <string>, <flag> )

Contents

Description

Returns a new binary variable created from a strings raw bytes

Parameters

string

The string to use.

flag

Optional; Encoding to use.

Choices are:

"ASCII" = Each byte will directly be converted to a single character and returned as a string

"UTF8" = Similar to ASCII but uses 2 bytes of one for each character of the string it will make

"UNICODE" = Alias to UTF8 (or whatever Sputnik is using for Unicode strings)

Some more options (Unlikely to be used)

"UTF7"

"UTF32"

Default: "ASCII"

Return Value

Returns a new binary variable created from a strings raw bytes

Remarks

None.

Example

ASCII Example

$binary = Pack("A*", "Hello World!");
$binStr = BinaryToStr($binary);
echo "String Content: $binStr\n";
// Prints:
// String Content: Hello World!
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox