filter Break Line - Java java.lang

Java examples for java.lang:String New Line

Description

filter Break Line

Demo Code


import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

  public static String filterBreakLine(String lines) {
    Pattern p = Pattern.compile("\\r\\n|\\r");
    Matcher m = p.matcher(lines);
    return (m.replaceAll("")).replaceAll("\\s+", " ");
  }//  w w  w. jav  a  2 s  .  co m
}

Related Tutorials