- public static void main(String[] args) {
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- String s = null;
- try {
- s = br.readLine();
- } catch (IOException e) {
- e.printStackTrace();
- }
- String fileLastNames[] = s.split("\\.");//以.分割字符串
- System.out.println(fileLastNames[fileLastNames.length-1]);//取到最后一串
- }
复制代码
你看一下,不知是不是你想要的效果 |