<< Click to Display Table of Contents >> Navigation: 3. Script Language > String commands > !Trim String > String Operations |
MiniRobotLanguage (MRL)
VBT. Command
Variable Both sides Trim
Intention
This command can be used to Trim Spaces from both sides of a variable-value.
By using the optional parameters you can trim any chars from both sides of the variable value.
Example:
VAR.§§LIN= 345 Hallo Marco
' We first remove the outer Spaces
VBT.§§LIN
DBP.>§§LIN<
' Result is: >345 Hallo Marco<
Now we use the Parameter P2.
VAR.§§LIN= 345 Hallo Marco
' $sp$ is a system-variable that is resolved to a SPACE character
VBT.§§LIN|$sp$345
DBP.>§§LIN<
' Result is: >Hallo Marco<
Now we use the third mode, for this Parameter P2 is the term "all"
VAR.§§LIN= 345 Hallo Marco $crlf$
' "all" means all characters with ASCII codes below 33
VBT.§§LIN|all
DBP.>§§LIN<
' Result is: >345 Hallo Marco<
Syntax
VBT.[P1][|P2]
Parameter Explanation
P1 - (optional) Source and Target-variable, if omitted,
TOS is used.
P2 - (optional) if given, ANY of the characters in P2
will be trimmed at both sides of P1
If Parameter 2 is "all" the characters from ASCI(0 to 32) and also $CR as well as $LF
will be trimmed from both sides of P1.
Example
''*************************************
' VBT/SBD - DEMO
'*************************************
VAR.§§LIN= 345 Hallo Marco
' We first remove the outer Spaces
VBT.§§LIN
PRT.>§§LIN<
' Now we remove the outer numbers and spaces
VBT.§§LIN|123 4567890
PRT.>§§LIN<
SBD.§§LIN|$sp$|4|§§ERG
MBX.§§ERG
END.
Remarks
-
Limitations:
-
See also:
• 1.5.2 Working with Text-Strings
• VTU. - Variable to Uppercase
• VTL. - Variable to Lowercase
• VTM. - Variable to Mediumcase
• VRD. - Variable-Remove-Doubles
• VAR. - Variable Set Value/Clear
• IVS. / NVS. - If-Variable-String
• SBD. - String between Delimiter
• SBM. - String between Delimiter-Multiple