private static Path replaceExtension(Path p, String newExtension) {
String newName = p.getFileName().toString();
private static Path replaceExtension(Path p, String newExtension) {
String newName = p.getFileName().toString();
- if (newName.contains("."))
- newName = newName.split("\\.")[0];
+ int lastDot = newName.lastIndexOf('.');
+ if (lastDot > -1)
+ newName = newName.substring(0, lastDot);