比如
D:\spket\eclipse\plugins\org.apache.xml.resolver_1.1.0.v200705310020.jar
我要截取spket\eclipse\plugins\org.apache.xml.resolver_1.1.0.v200705310020.jar
如何解决1
"D:\spket\eclipse\plugins\org.apache.xml.resolver_1.1.0.v200705310020.jar".substring(3);
用正则表达式啊
或者用string.split(":\")来截取,取后面的那个子字符串就行了
[code="java"] String s = "D:\spket\eclipse\plugins\org.apache.xml.resolver_1.1.0.v200705310020.jar";
System.out.print(s.substring(s.indexOf('\') + 1));[/code]
[code="java"]
String str = "D:\spket\eclipse\plugins\org.apache.xml.resolver_1.1.0.v200705310020.jar";
int index = str.indexOf("\\");
if(index != -1)
str = str.substring(index + 1);
System.out.println(str);
[/code]