String Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > String commands >

String Operations

Format Strings

Previous Top Next


MiniRobotLanguage (MRL)

 

Format Strings

Format Numbers and Align Strings for Display or Table Output

 

Intention

These Commands provide tools to format numeric values and align strings for clean, consistent output — essential for reports, tables, logs, and user interfaces.

Use `FMT.` to control decimal places or apply custom patterns to numbers. Use `VSL.`, `VSM.`, and `VSR.` to left-align, center, or right-align strings within a fixed width, optionally padding with a custom character.

 

Command Overview

 

 

 

•FMT. - Format Numeric Output – Format numbers by digit count or pattern

•VSL. - Variable Set Left – Left-align string in fixed width, pad with space or custom char

•VSM. - Variable Set Middle – Center-align string in fixed width, pad with space or custom char

•VSR. - Variable Set Right – Right-align string in fixed width, pad with space or custom char

 

Key Features

•Flexible numeric formatting: Use digit count (e.g., `|3`) or custom patterns (e.g., `|00.000`)

•String alignment: Left, center, or right align with optional fill character

•In-place modification: All Commands modify the variable directly — no result pushed to TOS

•Binary-safe: Preserves null bytes and special characters

•Default padding: If no fill character specified, uses space (`$sp$`)

 

See also

The Stack (TOS)

STR.String – Repeat single character

STR.Shrink – Collapse repeated delimiters

STR.Trim – Trim multi-character delimiters