String Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > String commands > !Format Strings >

String Operations

VSR. - Variable Set Right

Previous Top Next


MiniRobotLanguage (MRL)

 

VSR. Command

Variable Set Right Aligned

 

 

Intention

 

This command can be used to re-format a string in a way that it will fit into a table,

right -aligned. You can also specify the fill-character for the alignment.

Here is an example, we use the "*" as fill-character:

 

$$TXT=Theo

VSR.$$TXT|30|*

DBP.<$$TXT>

' Result is <******Theo>

 

In the second operation mode you can omit the fill-character, in this case just a SPACE ($sp$) is used as fill-character. It looks like this:

 

$$TXT=Peter

VSR.$$TXT|10

DBP.<$$TXT>

' Result is <     Peter>

 

 

 

 

 

Syntax

 

VSR.P1[|P2][|P3]

 

 

Parameter Explanation

 

 

P1   - Source and Target-variable.

 

P2   - (optional) if given then P1 specifies the number of

     fill-characters to be used. If omitted, 20 is used

     as default.

 

P3   - (optional) If specified, this is the fill-character to

     be used. If omitted, SPACE (ASCII 32) is used as default.

 

 

 

Example

 

'*************************************

' VTU./VTL./VTM.- DEMO

'*************************************

'

$$TXT=Peter

VSL.$$TXT|10|-

DBP.<$$TXT>

$$TXT=Peter

VSM.$$TXT|10|#

DBP.<$$TXT>

$$TXT=Peter

VSR.$$TXT|10|+

DBP.<$$TXT>

 

$$NUM=125.22222

FMT.$$NUM|00.000

DBP.$$NUM

ENR.

 

Will give this output:

 

graphic

 

 

 

Remarks

 

-

 

 

 

Limitations:

 

You can not specify an Null-String (empty variable) as Fill-character. Trying to do so, will make that $sp$ will be used for the alignment.

 

 

 

See also:

 

    1.5.2 Working with Text-Strings

    VSL. - Variable Set Left

    VSM. - Variable Set Middle

    VSR. - Variable Set Right

    FMT. - Format Numeric Output

    VBT. - Variable-Both-sides-Trim

    VAR. - Variable Set Value/Clear

    IVS. / NVS. - If-Variable-String

    ! STR. - String Command

    GSS. - GetSplitString

    LEN. - Length-of-String

    RPL. - RePLace in String