java.lang.Object CharCounter
public class CharCounter
Provides various counts of the characters in an array.
Constructor Summary | |
---|---|
CharCounter(char[] theArray)
Only constructor associates this CharCounter object with an existing array of characters. |
Method Summary | |
---|---|
int |
count()
Provides the total count of characters (same as the array's length). |
int |
count(char c)
Provides the count of a particular character. |
int |
countDigits()
Provides the total count of digit characters (0-9). |
int[] |
countEach(char[] c)
Provides the counts of each of an array of particular characters. |
int |
countLetters()
Provides the total count of letter characters (A-Z, a-z). |
int |
countOther()
Provides the total count of other characters (not letters or digits). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CharCounter(char[] theArray)
theArray
- the array of characters to count.Method Detail |
---|
public int count()
public int count(char c)
c
- the character to count.
public int[] countEach(char[] c)
c
- the array of characters to count.
public int countLetters()
public int countDigits()
public int countOther()