Cas*_*ynn 1 java string parsing
我在Java中创建一个命令行实用程序作为实验,我需要解析用户的一串输入.每次出现'&'时,需要将字符串分成组件.使用Java中的String对象执行此操作的最佳方法是什么.
这是我的基本代码:
//Process p = null;
Process p = null;
Runtime r = Runtime.getRuntime();
String textLine = "";
BufferedReader lineOfText = new BufferedReader(new InputStreamReader(System.in));
while(true) {
System.out.print("% ");
try {
textLine = lineOfText.readLine();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
//System.out.println(textLine);
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2459 次 |
最近记录: |