CharacterStats class
Utility class to analyze character statistics in text.
This class counts the number of letters and digits in a given text, which helps determine whether a string is primarily alphabetic or numeric. Used by text correction functions to make appropriate character substitutions.
Constructors
- CharacterStats([String text = ''])
-
Construct and inspect the
text
Properties
- digits ↔ int
-
The count of digit characters in the analyzed text.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- letters ↔ int
-
The count of letter characters in the analyzed text.
getter/setter pair
- lowercase ↔ int
-
The count of lower case characters in the analyzed text.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- spaces ↔ int
-
The count of space characters in the analyzed text.
getter/setter pair
- uppercase ↔ int
-
The count of upper case characters in the analyzed text.
Digits are considered uppercase
getter/setter pair
Methods
-
inspect(
String text) → void -
Analyzes the
textand updates letter and digit counts. -
mostlyDigits(
) → bool - Returns true if the analyzed text contains more digits than letters.
-
mostlyUppercase(
) → bool - Returns true if the analyzed text contains more uppercase than lowercase letters.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void - Clear the counters
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited