|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Arrays and Data-Structures > STK. - Stack > Overview of STK.Import and STK.Export |
MiniRobotLanguage (MRL)
Introduction
The STK.Import and STK.Export commands are essential for transferring data between stacks and string-based representations. These commands allow for efficient stack initialization, bulk updates, and data serialization for external processing.
Command Descriptions
- STK.Import|$$STK|$$STR[|$$DEL]: Populates the stack from a delimited string. If $$DEL is omitted, the default delimiter is used (";" for numeric types and Binary for strings). Each element in the delimited string becomes an entry in the stack.
- STK.Export|$$STK|$$DEL[|$$STR]: Converts the stack into a delimited string. The elements are concatenated with the specified delimiter $$DEL. If omitted, the default delimiter is used.
Parameters
- $$STK: The stack handle to operate on.
- $$STR: The input or output string for the operation.
- $$DEL: (Optional) The delimiter used to separate or join stack elements.
Use Cases
- Bulk Initialization: Quickly populate a stack with predefined data using STK.Import.
- Data Serialization: Save stack data as a string for external storage or transfer with STK.Export.
- Custom Delimiters: Use custom delimiters for compatibility with specific data formats.
Examples
' Example: Import a list of integers$$DATA="1;2;3;4;5"STK.Import|$$STK|$$DATA|;
' Example: Export stack content as a comma-separated stringSTK.Export|$$STK|,|$$OUTPUT
Remarks
These commands simplify data handling between stacks and external string representations. Proper delimiter management ensures compatibility with various data formats.
See also:
• STK.Push