public class Buggy
extends java.lang.Object
| Constructor and Description |
|---|
Buggy() |
| Modifier and Type | Method and Description |
|---|---|
double |
avgWordLength(java.lang.String s)
Computes average word length in a string.
|
int |
countWords(java.lang.String s)
Counts the words in a String.
|
java.lang.String |
reverseString(java.lang.String s)
Reverses the characters in a String
|
java.util.ArrayList<java.lang.String> |
splitString(java.lang.String s,
java.lang.String d)
Splits a String on a specified set of delimiters.
|
java.lang.String |
toLower(java.lang.String s)
Converts a string to all lower case.
|
java.lang.String |
toUpper(java.lang.String s)
Converts string to all upper case.
|
public java.lang.String toUpper(java.lang.String s)
s - the String to convert to upper casepublic java.lang.String toLower(java.lang.String s)
s - the String to convert to lower casepublic int countWords(java.lang.String s)
Character Name
. period
, comma
- hyphen
; semicolon
: colon
? question mark
' ' space
! exclamation point
For simplicity in this exercise, no other characters are considered separators. Examples: Number of words String
0 ""
1 "abc"
2 "abc def"
2 "hokey-pokey"
2 "Justin Bieber"
4 "(for String s1 : myStringList)"
s - the Stringpublic java.lang.String reverseString(java.lang.String s)
s - the String to reversepublic java.util.ArrayList<java.lang.String> splitString(java.lang.String s,
java.lang.String d)
public double avgWordLength(java.lang.String s)
Character Name
. period
, comma
- hyphen
; semicolon
: colon
? question mark
' ' space
! exclamation point
For simplicity in this exercise, no other characters are considered separators. Examples: Number of words String Average word length
1 "abc" 3.0
2 "abc def" 3.0
2 "hokey-pokey" 5.0
2 "Justin Bieber" 6.0
4 "(for String s1 : myStringList)" 6.25
s - the String to convert to upper case