Answers for "split but dont remove \n java"

0

remove new line in string of java

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

java split string without removing

String string = "Hello-World";
String[] split = string.Replace("-", "#-").Split("#"); 
//# is added to the Splitpoint so we can split on #

Output:
split = [Hello, -World]
Posted by: Guest on July-09-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language