<< Click to Display Table of Contents >> Navigation: 3. Script Language > String commands > !STR.- String Command > String Operations |
MiniRobotLanguage (MRL)
STR.CountAny
Counts Occurrences of Individual Characters in a String
Intention
This command is used to count the occurrences of individual characters within a source string using the ANY-CHARACTER option.
Each character in the match string is considered individually, and the count is incremented for each occurrence of that character in the source string.
•The command is case-sensitive.
•If the match string is not present in the source string, zero is returned.
•Repeated characters in the match string do not increase the count. For example, STR.CountAny|ABCD|BDB|$$CNT would return "2", not "3".
Syntax
STR.CountAny|P1|P2[|P3]
Parameter Explanation
•P1 - (Source String) The main string in which to count occurrences.
•P2 - (Match String) The characters to count, considered individually.
•P3 - (Optional) Variable for the result. If omitted, the result is placed on TOS (Top Of Stack).
Example
'***********************************
' STR.-Sample
'***********************************
$$SRC=<ABCDABCD>
$$MAT=<BDA>
STR.CountAny|$$SRC|$$MAT|$$CNT
' $$CNT will contain "8"
MBT.$$CNT
ENR.
Remarks
-
Limitations:
-
See also:
•