当找到一个特定的词并打破
when finding a specific word and breaking
我正在扫描来自用户的输入字符串。当用户在字符串中输入 #END 命令时,程序将中断并显示 output.How can i overve this?
例如;
Pay attention to how notes are taken. For instance, I can put #END
here, and it won't save the rest.
输出:
Pay attention to how notes are taken. For instance, I can put
最简单的方法是
String input = "Pay attention to how notes are taken. For instance, I can put #END here, and it won't save the rest.";
String [] out = input.split ("#END");
System.out.println (out[0]);
如果来自用户使用 Scanner
class.
我正在扫描来自用户的输入字符串。当用户在字符串中输入 #END 命令时,程序将中断并显示 output.How can i overve this?
例如;
Pay attention to how notes are taken. For instance, I can put #END here, and it won't save the rest.
输出:
Pay attention to how notes are taken. For instance, I can put
最简单的方法是
String input = "Pay attention to how notes are taken. For instance, I can put #END here, and it won't save the rest.";
String [] out = input.split ("#END");
System.out.println (out[0]);
如果来自用户使用 Scanner
class.