String Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > String commands > !STR.- String Command > String Replace Commands >

String Operations

STR.ReplaceAny / STR.Rpa

Previous Top Next


MiniRobotLanguage (MRL)

 

STR.ReplaceAny

Replace Any Matching Characters in a String with the corresponding character in a second string

 

clip0840

Replace single characters following a 1:1 relation between the $$MAT and $$NEW (P2 and P3).

 

 

Intention

 

This command is used to replace each occurrence of each character in P2 string with the corresponding character in P3 within the main string P1.

Replace is done directly in P1.

 

 

 

Syntax

 

 

STR.ReplaceAny|P1|P2|P3

STR.Rpa|P1|P2|P3

 

 

Parameter Explanation

 

P1 - (Mainstring, Text) Variable containing the source and the destination string.

P2 - (MatchString, Text) String containing characters to be replaced.

P3 - (NewString, Text) String containing characters to replace with.

  P2 and P3 must have the same length because we need a corresponding character "to replace with".

 

   Characters that are in P2 and have no counterpart in P3 are replaced with a ASCII 32 " ".

 

  clip1131

     Characters that are in P2 and have no counterpart in P3 are replaced with a ASCII 32 " ".

 

 

 

Example

 

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

' STR.-Sample

'***********************************
' Replace all occurrences of 'a' with '1' and 'b' with '2' in the string

$$SRC=ababab

$$MAT=ab

$$NEW=12

STR.ReplaceAny|$$SRC|$$MAT|$$NEW  

' $$SRC will now contain '121212'

ENR.

 

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

See also: