<< Click to Display Table of Contents >> Navigation: 3. Script Language > String commands > !STR.- String Command > String Operations |
MiniRobotLanguage (MRL)
STR.Count
Counts Occurrences of a Substring or Characters in a String
Intention
This command is used to count the number of occurrences of a specified substring or set of characters within a source string.
•The command is case-sensitive.
•If the match string is not present in the source string, zero is returned.
•When a match is found, the scan for the next match begins at the position immediately following the prior match.
Syntax
STR.Count|P1|P2[|P3]
Parameter Explanation
•P1 - (Source String) The main string in which to count occurrences.
•P2 - (Match String) The substring or characters to count.
•P3 - (Optional) Variable for the result. If omitted, the result is placed on TOS (Top Of Stack).
Example
'***********************************
' STR.-Sample
'***********************************
$$SRC=<abcabcabc>
$$MAT=<abc
STR.Count|$$SRC|$$MAT|$$CNT
' $$CNT will contain "1"
MBT.$$CNT
ENR.
Remarks
-
Limitations:
-
See also:
•