我正在完成这项任务,而且我第一次陷入困境。我甚至无法阅读给定的文本文件。帮帮我们请检查附件,看看我错在哪里
function getBetweenText(fromString, ignoreStart, ignoreEnd){ var s = fromString.split(new RegExp(ignoreStart+'|'+ignoreEnd)), r = []; for(var i=1,l=s.length; i<l; i+=2){ r.push(s[i]); } return r; } console.log(getBetweenText("STARTINGTEXTText I wantENDINGTEXT Text I don't want STARTINGTEXTMore text I wantENDINGTEXT Text I don't want", 'STARTINGTEXT', 'ENDINGTEXT'));
答案 0 :(得分:-1)
尝试使用标准Java类
BufferedReader br = new BufferedReader(
new InputStreamReader(new FileInputStream(fileName)));
try {
String line;
while ((line = br.readLine()) != null) {
// process line
}
} finally {
br.close();
}