UPDATE:
the output sould be:
chapter: Chapter 01
title: one
code: 111111
chapter: Chapter 02
title: two
code: 222222
chapter: Chapter 03
title: three
code: 333333
chapter: Chapter 04
title: four
code: 444444
chapter: Chapter 05
title: five
code: 555555
I have this code to split a string[]. I am not sure what the problem is. can anybody help me please?
String[] myArray = "Chapter 01<<<one<<<111111:::Chapter 02<<<two<<<222222:::Chapter 03<<<three<<<33333:::Chapter 04<<<four<<<4444:::Chapter 05<<<five<<<5555:::"
just for the sake of simplicity i have make the dummy String[]
for (int j = 0; j < myArray.length; j++)
{
String[] songs = myArray[j].split("\\<<<");
System.out.println("chapter: " + songs[0]);
System.out.println("title: " + songs[1]);
System.out.println("code: " + songs[2]);
}
so what i want to see in the result is:
chapter: Chapter 01
title: one
code: 111111
............so on and so forth........
1 Answer