0
我目前的問題是如何讀取文本文件與Java但包含管道「|」而在每次分離中,我都會得到它們中包含的單詞。我不通過在數組中拆分單詞
代碼要立即閱讀:
while ((sCurrentLine = br.readLine()) != null) {
String separado[] = sCurrentLine.split("|");
for (int i = 0; i < sCurrentLine.length(); i++) {
System.out.println(separado[i]);
}
// System.out.println(sCurrentLine);
}
文本文件結構我必讀:
Walther|28|M
Martha|28|F
Julio|28|M
目前的結果是:
W
a
l
t
h
e
r
|
2
8
|
M
M
a
r
t
h
a
|
2
8
|
F
J
u
l
i
o
|
2
8
|
M
我試圖改變下一行sCurrentLine.length()
對於這條線separado.lenght
但我得到了以下錯誤cannot find symbol variable separado of type String[]