假设文件中的行是:
代码:
String string = input.nextLine();
int index=0;
System.out.println(string);
if(string.contains(" "))
{
while(string.contains(" "))
{
int random = string.indexOf(" ");
String temp6 = string.substring(index,random);
ps.print(pig(temp6)+" ");
int temp8 = temp6.length();
String temp7 = string.substring(temp8+1,string.length());
string=temp7;
}
ps.print(pig(string));
}
else
{
ps.println(pig(string));
//}
}
对于输入:
Hello
Bob
Hello 之后如何让扫描仪跳过线路?或者我如何删除那个空行?