Maple für Professional
Maple für Akademiker
Maple für Studenten
Maple Personal Edition
Maple Player
Maple Player für iPad
MapleSim für Professional
MapleSim für Akademiker
Maple T.A. - Testen & beurteilen
Maple T.A. MAA Placement Test Suite
Möbius - Online-Courseware
Machine Design / Industrial Automation
Luft- und Raumfahrt
Fahrzeugtechnik
Robotics
Energiebranche
System Simulation and Analysis
Model development for HIL
Anlagenmodelle für den Regelungsentwurf
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematikausbildung
Technik
Allgemein- und berufsbildende Schulen
Testen und beurteilen
Studierende
Finanzmodelle
Betriebsforschung
Hochleistungsrechnen
Physik
Live-Webinare
Aufgezeichnete Webinare
Geplante Veranstaltungen
MaplePrimes
Maplesoft-Blog
Maplesoft-Mitgliedschaft
Maple Ambassador Program
MapleCloud
Technische Whitepapers
E-Mail Newsletters
Maple-Bücher
Math Matters
Anwendungs-Center
MapleSim Modell-Galerie
Anwenderberichte
Exploring Engineering Fundamentals
Lehrkonzepte mit Maple
Maplesoft Welcome-Center
Resource-Center für Lehrer
Help-Center für Studierende
StringTools[CharacterFrequencies] - compute the number of occurrences of each character in a string
Calling Sequence
CharacterFrequencies( s, filter )
Parameters
s
-
Maple string
filter
(optional) name or string; character class filter specifying frequencies returned
Description
The CharacterFrequencies(s) command returns an expression sequence of equations of the form character = frequency, where character is a single character string, and frequency is the number of times the corresponding character occurs in the string s.
The expression CharacterFrequencies( s ) is equivalent to seq( ch = CountCharacterOccurrences( s, ch ), ch = Support( s ) ), but computes the latter result more efficiently.
The frequencies appear in ASCII order; that is, in order of the numeric byte value of the character on the left-hand side of each equation. For an example illustrating how to sort by frequency, see the examples below.
To specify that the frequencies of only certain characters be returned, use an optional character class filter parameter. The parameter can be a string of characters to return, for example, "abcd" or one of the following character class names.
alpha
alphabetic characters
alnum
alphabetic characters and digits
ascii
ASCII (7-bit) characters
binary
"0" and "1"
cntrl
control characters
digit
decimal digits
hdigit
hexadecimal digits (both cases)
ident
identifier characters
ident1
leading identifier characters
lower
lower cases letters
odigit
octal digits (0-7)
space
whitespace characters
upper
upper case letters
vowel
vowels (both cases)
Examples
We can sort the results by frequency, as follows.
Use a filter to restrict attention to a limited class of characters.
See Also
character classes, sort, string, StringTools, StringTools[CountCharacterOccurrences], StringTools[Random], with
Download Help Document