CountCharacterOccurrences - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


StringTools

  

CountCharacterOccurrences

  

count the number of occurrences of a character in a string

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

CountCharacterOccurrences( s, ch )

Parameters

s

-

Maple string

ch

-

Maple string; character

Description

• 

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.

Examples

withStringTools:

CountCharacterOccurrencesabcde,a

1

(1)

CountCharacterOccurrencesabada,a

3

(2)

CountCharacterOccurrences,a

0

(3)

CountCharacterOccurrencesxyz,a

0

(4)

See Also

string

StringTools

StringTools[Exchange]

StringTools[Permute]

StringTools[Rotate]