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.
Details and Options
- CharacterCounts[string,n] counts n-grams that start at every position in string.
- CharacterCounts has the option IgnoreCase. With the setting IgnoreCaseTrue, characters are in effect all converted to lower case before being counted.
- CharacterCounts[BioSequence["type","seq"]] will give the characters of the string "seq".
Examplesopen allclose all
Basic Examples (3)
Wolfram Research (2015), CharacterCounts, Wolfram Language function, https://reference.wolfram.com/language/ref/CharacterCounts.html.
Wolfram Language. 2015. "CharacterCounts." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CharacterCounts.html.
Wolfram Language. (2015). CharacterCounts. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CharacterCounts.html