public static String collapseNewlines(String str){
  return collapseCharacter(str,'\n');
}

public static String collapseNewlines ( String str ) { return collapseCharacter ( str , '\n' ) ; }
remove / collapse multiple newline characters
