String Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > String commands >

String Operations

Change Case (upper/lowercase)

Previous Top Next


MiniRobotLanguage (MRL)

 

Change Case

Convert String Case: Uppercase, Lowercase, Mixedcase

 

Intention

These commands convert the case of a string variable to uppercase, lowercase, or mixedcase (first letter of each word capitalized). The conversion is applied directly to the variable’s content.

Useful for standardizing user input, preparing data for comparison, or formatting output.

 

Commands

 

VTU. - Variable to Uppercase – Convert all characters to uppercase

VTL. - Variable to Lowercase – Convert all characters to lowercase

VTM. - Variable to Mixedcase – Capitalize first letter of each word

 

Syntax

 

VTU.$$VAR

 

VTL.$$VAR

 

VTM.$$VAR

 

Parameter Explanation

 

$$VAR - (Variable) The variable whose content will be converted to the specified case.

 

Examples

 

' Convert to Uppercase

$$TEXT=Hello World

VTU.|$$TEXT

' $$TEXT = "HELLO WORLD"

 

' Convert to Lowercase

$$TEXT=Hello World

VTL.|$$TEXT

' $$TEXT = "hello world"

 

' Convert to Mixedcase

$$TEXT=hello world

VTM.|$$TEXT

' $$TEXT = "Hello World"

 

Remarks

Commands modify the variable **in-place** — no result is pushed to TOS.

Only alphabetic characters are affected; numbers, symbols, and spaces remain unchanged.

Mixedcase (`VTM`) capitalizes the first letter after any non-alphabetic character (space, punctuation, etc.).

Binary-safe: preserves null bytes and special characters.

 

Limitations

No support for locale-specific case conversion (e.g., Turkish I/İ).

Does not handle Unicode normalization (use `STR.Utf To Chr` and `STR.Chr To Utf` for advanced Unicode handling).

 

See also

The Stack (TOS)

STR.CiInstr – Case-insensitive search

STR.Instr – Standard search

STR.String – Repeat single character