StringCount
Usage
• StringCount["string", "sub"] gives a count of the number of times "sub" appears as a substring of "string". • StringCount["string", patt] gives the number of substrings in "string" that match the general string expression patt. • StringCount["string", { , , ... }] counts the number of occurrences of any of the . • StringCount[{ , , ... }, p] gives the list of results for each of the .
Notes
• Example: StringCount["abbaabbaa", "bb"]  . • The string expression patt can contain any of the objects specified in the notes for StringExpression. • Example: StringCount["abcadcacb", "a"~~_~~"c"]  . • With the default option setting Overlaps -> True, StringCount counts as separate substrings that overlap. With the setting Overlaps -> False such substrings are not treated as separate. • With Overlaps -> All, multiple substrings that match the same string expression are all counted as separate. With Overlaps -> True, only the first such matching substring at a given position is counted as separate. • Setting the option IgnoreCase -> True makes StringCount treat lower- and upper-case letters as equivalent. • Example: StringCount["abAB", "a", IgnoreCase -> True]  . • StringCount["string", RegularExpression["regex"]] gives the number of substrings matching the specified regular expression. • New in Version 5.1.
|