StringTools
CountCharacterOccurrences
count the number of occurrences of a character in a string
Calling Sequence
Parameters
Description
Examples
CountCharacterOccurrences( s, ch )
s
-
Maple string
ch
Maple string; character
The CountCharacterOccurrences( s, ch ) calling sequence counts the number of occurrences of the character ch in the string s. A non-negative integer is returned.
All of the StringTools package commands treat strings as (null-terminated) sequences of 8-bit (ASCII) characters. Thus, there is no support for multibyte character encodings, such as unicode encodings.
withStringTools:
CountCharacterOccurrencesabcde,a
1
CountCharacterOccurrencesabada,a
3
CountCharacterOccurrences,a
0
CountCharacterOccurrencesxyz,a
See Also
string
StringTools[Exchange]
StringTools[Permute]
StringTools[Rotate]
Download Help Document