gives an association whose keys are the distinct characters in string, and whose values give the number of times those characters appear in string.
gives counts of the distinct n-grams consisting of runs of n characters in string.
Examplesopen allclose all
Basic Examples (3)
Count the distinct characters in a string:
Character counts include all characters, including numbers, punctuation, and whitespace:
Count the distinct 2-gram sequences in a string:
Count n-grams regardless of case:
Neat Examples (1)
Find the most frequently occurring characters in the Gettysburg Address:
Do the same for 3-character sequences:
Introduced in 2015