public static String stripHTMLTags ( String documentation ) { if ( documentation == null ) { return "" ; } if ( documentation . startsWith ( "<" ) ) { int startTagIndex = documentation . indexOf ( ">" ) ; final int closingTagIndex = documentation . lastIndexOf ( "<" ) ; if ( closingTagIndex > startTagIndex ) { documentation = stripHTMLTags ( documentation . substring ( startTagIndex + 1 , closingTagIndex ) ) ; } else { documentation = stripHTMLTags ( documentation . substring ( startTagIndex + 1 ) ) ; } } return documentation . trim ( ) ; }
Returns a documentation with HTML tags prefixed and suffixed removed or returns empty string if the input is empty or null . This method is to be used when constructing documentation for method parameters .