src/java/org/pifan/util/StringUtils.java
/**
     * This method will capitalize all of the individual words in a sentence.
     * 
     * @param str
     * @param ignoreList
     * @return
     */
This method will capitalize all of the individual words in a sentence.

@param str
@param ignoreList
@return
This method will capitalize all of the individual words in a sentence . @param str @param ignoreList @return
public static final String capitalizeWords(String str) {
        if (!StringUtils.isValidString(str)) {
            return "";
        }
        str = str.trim();
        str = str.toLowerCase();
        str = (str.length() > 0) ? Character.toUpperCase(str.charAt(0)) + str.substring(1) : str;
        boolean shouldCap = false;
        for (int i = 1; i < str.length(); i++) {
            if (str.charAt(i) == ' ') {
                shouldCap = true;
            } else {
                if (shouldCap) {
                    str = str.substring(0, i) + Character.toUpperCase(str.charAt(i)) + str.substring(i + 1);
                    shouldCap = false;
                }
            }
        }
        return str;
    }
public static final String capitalizeWords ( String str ) { if ( ! StringUtils . isValidString ( str ) ) { return "" ; } str = str . trim ( ) ; str = str . toLowerCase ( ) ; str = ( str . length ( ) > 0 ) ? Character . toUpperCase ( str . charAt ( 0 ) ) + str . substring ( 1 ) : str ; boolean shouldCap = false ; for ( int i = 1 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == ' ' ) { shouldCap = true ; } else { if ( shouldCap ) { str = str . substring ( 0 , i ) + Character . toUpperCase ( str . charAt ( i ) ) + str . substring ( i + 1 ) ; shouldCap = false ; } } } return str ; }
This method will capitalize all of the individual words in a sentence.
This method will capitalize all of the individual words in a sentence .
// trim everything
 // first make everything lower case
 // capitalize the first letter
 // try to capitalize any remaining words
