+ 1

How Can Add New Line Print If Include "##" With Single String In Java ????

Sting = "##This is Demo line ##This is a Question ## Give Me Answer of This Question ## Can You Help Me"; OutPut Line:------ ##This is Demo line ##This is a Question ## Give Me Answer of This Question ## Can You Help Me" ———— Main Point ———— After "##" Not Also Same Line

23rd May 2020, 5:00 AM
Rahul Deshwal
Rahul Deshwal - avatar
2 Antworten
0
String str = "## This is Demo line ## This is a Question ## Give Me Answer of This Question ## Can You Help Me"; str = str.replaceAll("##","\n##"); System.out.println( str.substring(1) );
23rd May 2020, 6:01 AM
zemiak
0
String str = "##This is Demo line ##This is a Question ## Give Me Answer of This Question ## Can You Help Me"; String[] strarr = str.split("#"); for(String s: strarr) System.out.println(s); //hope it helps
23rd May 2020, 6:19 AM
pankaj kumar