@bytes
Convert a value to hex bytes, force UTF-8 encoding, or perform a bitwise operation.
Returns: bytes
Syntax
Section titled “Syntax”@bytes(a b? c?)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
a |
any |
Value to convert or left operand |
[b] |
string |
Operator (& ` |
[c] |
any |
Right operand for bitwise ops |
Examples
Section titled “Examples”# Convert a number to bytesset $b @bytes(0xff)
# Bitwise ANDset $b @bytes(0xff00 "&" 0x0ff0)
# Left shiftset $b @bytes(0x01 "<<" 8)See Also
Section titled “See Also”- @bytes.not — bitwise NOT
- @bytes.concat — concatenate bytes
- @bytes.slice — extract a byte range