Java tutorial
//package com.java2s; public class Main { /** * Convert to CRLF * @param text * @return */ private static String convertToCrlf(String text) { String repCrlf = text.replaceAll("\r\n", "\n"); String repLf = repCrlf.replaceAll("\r", "\n"); String rep = repLf.replaceAll("\n", "\r\n"); return rep; } }