Java String Collapse collapseLines(String message)

Here you can find the source of collapseLines(String message)

Description

Returns a string with all break lines replaced by the string "\n"

License

Open Source License

Parameter

Parameter Description
message a parameter

Declaration

public static String collapseLines(String message) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from   w w  w .java  2  s. c  o  m
     * Returns a string with all break lines replaced by the string "\n"
     * @param message
     * @return 
     */
    public static String collapseLines(String message) {
        return message.replaceAll("\n", "\\\\n");
    }
}

Related

  1. collapse(float[][] array)
  2. collapse(String str, String characters, String replacement)
  3. collapse(String t)
  4. collapse(String text)
  5. collapsedName(Class klass)
  6. collapseMultipleNewlinesToOne(String s)
  7. collapseName(String name)
  8. collapseNewlines(String argStr)
  9. collapseString(String data, String collapse)