Answers for "delete one line in java"

1

java remove empty lines from string

String text = "line 1\n\nline 3\n\n\nline 5";
String adjusted = text.replaceAll("(?m)^[ \t]*\r?\n", "");
// ...
Posted by: Guest on June-27-2021
0

remove new line in string of java

String text = "line 1\n\nline 3\n\n\nline 5";
String adjusted = text.replaceAll("(?m)^[ \t]*\r?\n", "");
Posted by: Guest on October-07-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language