UPDATE :분할 문자열 []
출력 될 sould :
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 문자열 []를 분할하는 코드를 갖는다. 문제가 무엇인지 잘 모르겠습니다. 아무도 나 좀 도와 줄래? 단지 내가 결과에서보고 싶은 그래서 더미 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]);
}
을 가지고 단순화를 위해
String[] myArray = "Chapter 01<<<one<<<111111:::Chapter 02<<<two<<<222222:::Chapter 03<<<three<<<33333:::Chapter 04<<<four<<<4444:::Chapter 05<<<five<<<5555:::"
은 다음과 같습니다
chapter: Chapter 01
title: one
code: 111111
............so on and so forth........
출력을 원하는 * 것으로 지정하지만 실제로 출력되는 내용은 무엇입니까? –
출력을 게시하십시오. – joshua
왜 split 대신 StringTokenizer를 사용할 수 없습니까? 그것은 당신을 도울 세 가지 생성자가 있습니다. – developer