Core Function Unpack
(→flag) |
(→flag) |
||
Line 29: | Line 29: | ||
2 = Force return of single item as is (string, int, float etc) regardless if (key) etc was used | 2 = Force return of single item as is (string, int, float etc) regardless if (key) etc was used | ||
− | Basically set it to 0 to get the array or single item if applicable, 1 to return a string regardless of what content is (such as int) | + | 3 = Force return to be an array regardless of what it contains |
+ | |||
+ | Basically set it to 0 to get the array or single item if applicable, 1 to return a string regardless of what content is (such as int), 2 to return the first object intact (no string conversion) and finally 3 to force it to be an array no matter what. | ||
Default: 0 | Default: 0 |
Revision as of 11:59, 26 September 2013
Unpack( <expression>, <binary-array/string>, <flag> )
Contents |
Description
Unpack data from a binary array
expression
The format string to use.
binary-array/string
An binary array of bytes such as one produced by the Pack function.
OR
A string to be converted into a binary array of bytes (z0 ASCII encoding).
flag
Optional; Control what is returned options are:
0 = Return an array (If there is more than one item or just return THAT item by itself (provided no (key) was used) not in an array)
1 = Return a string (Regardless of how many items are to be returned it will just append them)
2 = Force return of single item as is (string, int, float etc) regardless if (key) etc was used
3 = Force return to be an array regardless of what it contains
Basically set it to 0 to get the array or single item if applicable, 1 to return a string regardless of what content is (such as int), 2 to return the first object intact (no string conversion) and finally 3 to force it to be an array no matter what.
Default: 0
Return Value
Success: Returns the array of data (Only if its over 1 item, For single items (provided there was no (key) used) it will return the item such as string, int, float etc) unless the flag is set to 1 then it will return a string regardless of what the item is or how many there are.
Failure: Returns null.
Remarks
Go see Pack( <expression>, <expressions> ) for a list of formats and examples.
Example
Go see Pack( <expression>, <expressions> ) for a list of formats and examples.