| 内容 | 
		     这里要区分的是目录路径     如:     /opt/deve/tomcat/bin     c:deveomcatin     都是绝对目录路径     bin     bin/data     bindata     都是相对目录路径     通过观察,发现规律     以/开始 或者 包含或//的都是绝对路径 或者     以/开始 或者 包含:的都是绝对路径     反之就是相对路径     介绍几个方法:     startswith     public class stringutil {     public static void main(string[] args) {     string path = /opt/bin;     system.out.println(path.startswith(/));     }     }     结果:true     indexof     最终结果:     /**     * 传入路径,返回是否是绝对路径,是绝对路径返回true,反之     *     * @param path     * @return     * @since 2015年4月21日     */     public boolean isabsolutepath(string path) {     if (path.startswith(/) || path.indexof(:) > 0) {     return true;     }     return false;     }
  |