class Const {

  public static String initCap( String string ) {
    StringBuilder change = new StringBuilder( string );
    boolean new_word;
    int i;
    char lower, upper, ch;

    new_word = true;
    for ( i = 0; i < string.length(); i++ ) {
      lower = change.substring( i, i + 1 ).toLowerCase().charAt( 0 ); // Lowercase is default.
      upper = change.substring( i, i + 1 ).toUpperCase().charAt( 0 ); // Uppercase for new words.
      ch = upper;

      if ( new_word ) {
        change.setCharAt( i, upper );
      } else {
        change.setCharAt( i, lower );
      }

      new_word = false;

      // Cast to (int) is required for extended characters (SB)
      if ( !Character.isLetterOrDigit( (int) ch ) && ch != '_' ) {
        new_word = true;
      }
    }

    return change.toString();
  }

}