Documentation Comments
Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.
Reality V15.0 ()
COUNTS Function (DataBasic) (m618703+counts_f.htm)
Counts the number of times a substring occurs in each element of a dynamic array.
COUNTS(dynArray, substring)
dynArray A DataBasic expression that evaluates to a dynamic array.
substring A DataBasic expression that evaluates to a string.
A dynamic array with the same structure as dynArray, but with each element replaced by the number of times substring occurs in that element.
If substring is null, each element is replaced by its length in characters.
Substrings can overlap; for example, substring AA occurs three times in string AAAA.
Note: This behaviour can be modified with the UNIQUE.COUNT compatibility switch option.
ARY = "MMI":@AM:"MCMLXXXVII":@AM:"MCMXCVIII" NEWARY = COUNTS(ARY, "II")
Sets NEWARY to "0AM1AM2". The third element is 2 because COUNTS matches the overlapping elements.