public static String strip ( String text ) { String result = text ; if ( text != null && ! text . isEmpty ( ) ) { try { boolean formalRTF = isFormalRTF ( text ) ; StringTextConverter stc = new StringTextConverter ( ) ; stc . convert ( new RtfStringSource ( text ) ) ; result = stripExtraLineEnd ( stc . getText ( ) , formalRTF ) ; } catch ( IOException ex ) { result = "" ; } } return result ; }
This method removes all RTF formatting from a given piece of text .