public static String toTitleCaseWord ( String string ) { Check . notNull ( string ) ; final String [ ] words = SPACE . split ( REPLACER . matcher ( string ) . replaceAll ( Constant . SPACE ) ) ; final StringBuilder title = new StringBuilder ( string . length ( ) ) ; for ( int i = 0 ; i < words . length ; i ++ ) { title . append ( toTitleCase ( words [ i ] ) ) ; if ( i < words . length - 1 ) { title . append ( Constant . SPACE ) ; } } return title . toString ( ) ; }
Convert a string to a pure title case for each word replacing special characters by space .