RFR: 8298318: (fs) APIs for handling filename extensions
Brian Burkhalter
bpb at openjdk.org
Fri Nov 3 18:38:05 UTC 2023
On Thu, 2 Nov 2023 19:08:45 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
> The spec will need to explain/define how to trim off the extension, so the new extension can be added.
Something like this perhaps for the nominal case?
Path p;
String name = p.getFileName().toString();
String ext = p.getExtension();
String s = name.substring(0, name.lastIndexOf(ext) - 1);
Path stripped = p.resolveSibling(s);
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16226#issuecomment-1792947777
More information about the nio-dev
mailing list