Home > Net >  Separate string array elements with next line \n or separator
Separate string array elements with next line \n or separator

Time:03-30

I need some help with these strings. My code is:

String string = database.getCurrentDate();;
String[] array = string.split("[.]", 0);
String date = array[0]   "."   array[1];
String string1=database.getCurrentHour();
String[] array1=string1.split("[:]",0);
String hour=array1[0] ":" array1[1];
String finalString=date hour;// finalString is 28.0310:45

I need that finalString to be:

date
hour//on next line
example:
28.03//date
10:45//hour

The point is that I need the hour to be displayed on the next line, under date. Thank you!

CodePudding user response:

String finalString = date   "\n"   hour

Don't work if you display this?

  • Related