나는 IMDB에서 TSV를 시도하고있어 구문 분석 :탭으로 구분 된 파일
$hutter Battle of the Sexes (2017) (as $hutter Boy) [Bobby Riggs Fan] <10>
NVTION: The Star Nation Rapumentary (2016) (as $hutter Boy) [Himself] <1>
Secret in Their Eyes (2015) (uncredited) [2002 Dodger Fan]
Steve Jobs (2015) (uncredited) [1988 Opera House Patron]
Straight Outta Compton (2015) (uncredited) [Club Patron/Dopeman]
$lim, Bee Moe Fatherhood 101 (2013) (as Brandon Moore) [Himself - President, Passages]
For Thy Love 2 (2009) [Thug 1]
Night of the Jackals (2009) (V) [Trooth]
"Idle Talk" (2013) (as Brandon Moore) [Himself]
"Idle Times" (2012) {(#1.1)} (as Brandon Moore) [Detective Ryan Turner]
일부 라인 탭으로 시작하지 않는 몇 가지로
. 저는 배우의 이름을 키로하고 영화 목록을 값으로 사용하여지도를 원합니다. 배우의 이름 사이에는 동영상 목록까지의 하나 이상의 탭이 있습니다.
내 코드 :
while ((line = reader.readLine()) != null) {
Matcher matcher = headerPattern.matcher(line);
boolean headerMatchFound = matcher.matches();
if (headerMatchFound) {
Logger.getLogger(ActorListParser.class.getName()).log(Level.INFO, "Header for actor list found");
String newline;
reader.readLine();
while ((newline = reader.readLine()) != null) {
String[] fullLine = null;
String actor;
String title;
Pattern startsWithTab = Pattern.compile("^\t.*");
Matcher tab = startsWithTab.matcher(newline);
boolean tabStartMatcher = tab.matches();
if (!tabStartMatcher) {
fullLine = newline.split("\t.*");
System.out.println("Actor: " + fullLine[0] +
"Movie: " + fullLine[1]);
}//this line will have code to match lines that start with tabs.
}
}
}
내가 얻을 arrayoutofbounds
예외 전에 내가 몇 줄이 비로소 작동을 수행 한 방법. 줄을 파싱하고 하나 이상의 탭이있는 경우 최대 2 줄로 분할 할 수 있습니까?
데이터 목록을 스크린 샷으로 게시하지 마십시오. 복사/붙여 넣기 데이터 및 고정 너비 서식을 4 칸 들여 쓰기. –
데이터 목록 문제가 실제로 SO 규칙입니까? 데이터를 붙여 넣기 복사가 엉망이며 수정하는 데 오랜 시간이 걸립니다. – user465001
매우 강력하게 추천합니다. 전체 화면이 아닌 질문을 전달하기에 충분할 정도로 몇 줄의 데이터 만 표시하면됩니다. 이미지는 진정한 이미지 인 경우에만 예약해야합니다. 텍스트 인 경우 게시물에 텍스트로 포함됩니다. –