convert new Line \n To <Br> - Android java.lang

Android examples for java.lang:String HTML

Description

convert new Line \n To <Br>

Demo Code

import java.net.MalformedURLException;
import java.net.URL;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main{

    public static String newLineToBr(String s) {
        if (s == null)
            return null;

        return replace(s, "\n", "<br>");
    }//w  w  w . j a v  a  2  s.com

}

Related Tutorials