java 判断字符串是不是路径

Python011

java 判断字符串是不是路径,第1张

public static void main(String[] args)

{

String str="ABC_001"

if(str.indexOf("ABC")!=-1){

System.out.println("包含")

}else{

System.out.println("不包含")

}

}

您好,提问者: 比如:D:\aa\bb\cc 绝对路径:D:\aa\bb\cc(全路径) 相对路径:\bb\cc或者\cc或者\aa\bb\cc //根据要求做截取 Thread.currentThread().getClass().getResource("").getPath()