private static void writeParagraphs ( final String text , final XmlStringBuilder xml ) { if ( ! Util . empty ( text ) ) { int start = 0 ; int end = text . length ( ) - 1 ; // Set the start index to the first non-linebreak, so we don't emit leading ui:nl tags for ( ; start < end ; start ++ ) { char c = text . charAt ( start ) ; if ( c != ' ' && c != ' ' ) { break ; } } // Set the end index to the last non-linebreak, so we don't emit trailing ui:nl tags for ( ; start < end ; end -- ) { char c = text . charAt ( end ) ; if ( c != ' ' && c != ' ' ) { break ; } } char lastChar = 0 ; for ( int i = start ; i <= end ; i ++ ) { char c = text . charAt ( i ) ; if ( c == ' ' || c == ' ' ) { if ( lastChar != 0 ) { xml . write ( "<ui:nl/>" ) ; } lastChar = 0 ; } else { xml . write ( c ) ; lastChar = c ; } } } }
Writes out paragraph delimited content .