public String hyphenate ( String text , Character shy , Character zwsp ) throws StandardHyphenationException { if ( shy == null && zwsp == null ) return text ; byte [ ] hyphens = hyphenate ( text ) ; StringBuffer hyphenatedText = new StringBuffer ( ) ; int i ; for ( i = 0 ; i < hyphens . length ; i ++ ) { hyphenatedText . append ( text . charAt ( i ) ) ; if ( shy != null && hyphens [ i ] == SHY ) hyphenatedText . append ( shy ) ; else if ( zwsp != null && hyphens [ i ] == ZWSP ) hyphenatedText . append ( zwsp ) ; } hyphenatedText . append ( text . charAt ( i ) ) ; return hyphenatedText . toString ( ) ; }
Returns the fully hyphenated string . The given hyphen characters are inserted at all possible hyphenation points .