String Transformers Problem Set Javadocs

cs101.util
Class StringUtils

java.lang.Object
  extended bycs101.util.StringUtils

public final class StringUtils
extends java.lang.Object

cs101.util.StringUtils implements some string utility functions. It is intended as a library class, i.e., all methods are static.
Copyright 1996 Massachusetts Institute of Technology

Version:
$Id: StringUtils.java,v 1.1.1.1 2002/06/05 21:56:32 root Exp $
Author:
Lynn Andrea Stein, las@ai.mit.edu

Field Summary
static java.lang.String nonWordChars
          A string containing the non-word characters a user might reasonably be expected to type at a semi-standard American keyboard.
 
Method Summary
static boolean allUpperCaseP(java.lang.String word)
          Determines whether all of the characters in its argument word are upper case.
static java.lang.String capitalize(java.lang.String word)
          Constructs a new string identical to its argument, but with the first character replaced by its upper case equivalent.
static java.lang.String capitalizeAll(java.lang.String word)
          Constructs a new string identical to its argument, but with all characters replaced by their upper case equivalents.
static boolean capitalizedP(java.lang.String word)
          Determines whether the first character of its argument word is upper case.
static int firstVowelPos(java.lang.String word)
          Computes the index of the first position in String which contains a vowel (i.e., one of AEIOU).
static java.lang.String unCapitalize(java.lang.String word)
          Constructs a new string identical to its argument, but with the first character replaced by its lower case equivalent.
static boolean wordP(java.lang.String word)
          Determines whether its argument is a word or a delimiter as defined by a java.util.StringTokenizer when initialized with StringUtils.nonWordChars as a delimiter string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nonWordChars

public static final java.lang.String nonWordChars
A string containing the non-word characters a user might reasonably be expected to type at a semi-standard American keyboard. Suitable for using as delimiters for java.util.StringTokenizer.

See Also:
StringTokenizer, Constant Field Values
Method Detail

wordP

public static final boolean wordP(java.lang.String word)
Determines whether its argument is a word or a delimiter as defined by a java.util.StringTokenizer when initialized with StringUtils.nonWordChars as a delimiter string.

Parameters:
word - String to be tested for "wordness".
Returns:
false if word is one of the delimiters in StringUtils.nonWordChars, true otherwise.
See Also:
StringTokenizer, nonWordChars, String

capitalizedP

public static final boolean capitalizedP(java.lang.String word)
Determines whether the first character of its argument word is upper case.

Parameters:
word - String to be checked for capitalization.
Returns:
true if first character is upper case.
See Also:
Character.isUpperCase(char), String.charAt(int)

allUpperCaseP

public static final boolean allUpperCaseP(java.lang.String word)
Determines whether all of the characters in its argument word are upper case.

Parameters:
word - String to be checked for capitalization.
Returns:
true if all characters are is upper case.
See Also:
Character.isLowerCase(char), String.charAt(int), String.length()

capitalize

public static final java.lang.String capitalize(java.lang.String word)
Constructs a new string identical to its argument, but with the first character replaced by its upper case equivalent.

Parameters:
word - String to be capitalized.
Returns:
the new, capitalized String.
See Also:
Character.toUpperCase(char), StringBuffer, String.charAt(int), String.valueOf(char)

capitalizeAll

public static final java.lang.String capitalizeAll(java.lang.String word)
Constructs a new string identical to its argument, but with all characters replaced by their upper case equivalents.

Parameters:
word - String to be uppercased.
Returns:
the new, uppercased String.
See Also:
Character.toUpperCase(char), String.length(), String.charAt(int), StringBuffer

unCapitalize

public static final java.lang.String unCapitalize(java.lang.String word)
Constructs a new string identical to its argument, but with the first character replaced by its lower case equivalent.

Parameters:
word - String to be unCapitalized.
Returns:
the new, unCapitalized String.
See Also:
Character.toLowerCase(char), String.length(), String.charAt(int), String.valueOf(char)

firstVowelPos

public static final int firstVowelPos(java.lang.String word)
Computes the index of the first position in String which contains a vowel (i.e., one of AEIOU).

Parameters:
word - String to be searched for vowel.
Returns:
index of first vowel, length of word if no vowel.
See Also:
String.length(), String.charAt(int)

String Transformers Problem Set Javadocs