Here you can find the source of replaceR(String str)
public static String[] replaceR(String str)
//package com.java2s; public class Main { public static String[] replaceR(String str) { String[] s = { "", "" }; String strReturn = ""; if (str.indexOf("\r\n") != -1) { s[1] = "\r\n"; s[0] = str.replaceAll("\r\n", ""); return s; } else if (str.indexOf("\n") != -1) { s[1] = "\n"; s[0] = str.replaceAll("\n", ""); return s; } else if (str.indexOf("\r") != -1) { s[1] = "\r"; s[0] = str.replaceAll("\r", ""); }//from w ww .j a v a 2 s . c o m s[0] = str; return s; } }