我想从给定的字符串中提取一个特定的图像路径字符串。如何从给定的字符串中提取文本?
字符串为http:\localhost:9090\SpringMVC\images\integration-icon.png
现在我想只有像
\images\integration-icon.png
图像之后的路径我想这
Pattern pattern = Pattern.compile("SpringMVC");
Matcher matcher = pattern.matcher(str);
System.out.println("Checking");
if (matcher.find()) {
System.out.println(matcher.group(1));
}
我怎样才能得到?
** perticular **是什么意思? – SpringLearner
如果您使用的是Java 7,请注意Path类http://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html – DominikM
为什么您给了我-2? –