我想将字符串"test/"和"/go"组合为"test/go"。
我该怎么做呢?
发布于 2011-04-08 15:39:11
来自Apache Commons IO的FilenameUtils.normalize()可以满足您的需求。
示例:
FilenameUtils.normalize("foo/" + "/bar");返回字符串"foo/bar"
发布于 2011-04-08 15:45:22
只使用java.io.File最简单的方法是:
String combined_path = new File("test/", "/go").getPath();https://stackoverflow.com/questions/5591875
复制相似问题