public static String cleanLeadingAndTrailingNewLineAndChars(String input){
  if (!StringUtils.hasText(input)) {
    return input;
  }
  String output=input;
  output=output.replaceAll("[\\s]+\\*[\\s]+"," ");
  while (output.startsWith("/") || output.startsWith("\n") || output.startsWith("*")|| output.startsWith("-")|| output.startsWith("\t")|| output.startsWith(" ")|| output.startsWith("\\")) {
    output=output.substring(1);
  }
  while (output.endsWith("/") || output.endsWith("\n") || output.endsWith(" ")|| output.endsWith(",")|| output.endsWith("\t")|| output.endsWith("-")|| output.endsWith("*")) {
    output=output.substring(0,output.length() - 1);
  }
  return output;
}

public static String cleanLeadingAndTrailingNewLineAndChars ( String input ) { if ( ! StringUtils . hasText ( input ) ) { return input ; } String output = input ; output = output . replaceAll ( "[\\s]+\\*[\\s]+" , " " ) ; while ( output . startsWith ( "/" ) || output . startsWith ( "\n" ) || output . startsWith ( "*" ) || output . startsWith ( "-" ) || output . startsWith ( "\t" ) || output . startsWith ( " " ) || output . startsWith ( "\\" ) ) { output = output . substring ( 1 ) ; } while ( output . endsWith ( "/" ) || output . endsWith ( "\n" ) || output . endsWith ( " " ) || output . endsWith ( "," ) || output . endsWith ( "\t" ) || output . endsWith ( "-" ) || output . endsWith ( "*" ) ) { output = output . substring ( 0 , output . length ( ) - 1 ) ; } return output ; }
utility method to clean new line , spaces and other highly useless characters found ( mainly in javadoc )
