這是我的代碼爪哇分割線不工作
//Numbers (Need errors on sort and numbers)
if(line.contains("n"))
{
//split the line with space
String[] LineSplit = line.split(" ");
if(LineSplit[0].contains("n"))
{
//split the already split line with "n thename "
String[] LineSplit2 = line.split("n " + LineSplit[0] + " ");
String text = "var " + LineSplit[1] + "=" + LineSplit2[0] + ";";
text = text.replace("\n", "").replace("\r", "");
JAVASCRIPTTextToWrite += text;
}
}
文本行是 n個1
輸出應該是
變種數= 1;
但輸出是
變種數目= n個= 1;
有人可以告訴我如何解決這個問題嗎?代碼看起來正確,但不工作:(
把第3行改爲:StringBuilder sb = new StrignBuilder(「var」); 。 「var」 – TheLostMind
完成後需要額外的空間觀察 –