摘要: 写个小程序用到将输入的路径字符串分割成路径和文件名两个字符串,就学习了下java中的字符串分割。网上查了下有两种方法。第一种是用String的split方法,另一种是StringTokenizer。应该还是有其他方法的,希望了解的同学们可以指点一下。 一.split,直接上代码吧。 1 public class SplitTest { 2 3 4 public static void main(String[] args) { 5 String path = "d:\\a\\b\\c.txt"; 6 String fileName; 7 String parentPath; 阅读全文
posted @ 2011-07-05 16:31 LazyGunner 阅读(1577) 评论(0) 推荐(0) 编辑