Replace \r\n with the <br> tagTag(s): String/Number
This can be done easily a regular expression.
[JDK1.4]
import java.util.regex.Pattern; import java.util.regex.Matcher; ... // 4 different combinaisons Pattern CRLF = Pattern.compile("(\r\n|\r|\n|\n\r)"); Matcher m = CRLF.matcher(myString); if (m.find()) { newString = m.replaceAll("<br>"); }
newString = myString.replaceAll("(\r\n|\r|\n|\n\r)", "<br>");