public static String wrap ( String str , int wrapTextLength ) { if ( wrapTextLength <= 0 ) return str ; StringBuilder rtn = new StringBuilder ( ) ; String ls = SystemUtil . getOSSpecificLineSeparator ( ) ; Array arr = ListUtil . listToArray ( str , ls ) ; int len = arr . size ( ) ; for ( int i = 1 ; i <= len ; i ++ ) { rtn . append ( wrapLine ( Caster . toString ( arr . get ( i , "" ) , "" ) , wrapTextLength ) ) ; if ( i + 1 < len ) rtn . append ( ls ) ; } return rtn . toString ( ) ; }
wraps a String to specified length