[ https://issues.apache.org/jira/browse/GROOVY-10942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17690850#comment-17690850 ]
ASF GitHub Bot commented on GROOVY-10942: ----------------------------------------- Goooler commented on code in PR #1859: URL: https://github.com/apache/groovy/pull/1859#discussion_r1111190774 ########## subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/extensions/NioExtensions.java: ########## @@ -101,6 +101,36 @@ public static long size(Path self) throws IOException { return Files.size(self); } + /** + * Provide the extension of this path. + * + * @param self a path object + * @return the extension of this path (not including the dot), or an empty string if it doesn't have one. + * @since 5.0.0 + */ + public static String getExtension(Path self) { + final Path fileName = self.getFileName(); + final String name = fileName == null ? "" : fileName.toString(); Review Comment: Yeah, that's what I'm afraid. > Add `extension` & `nameWithoutExtension` extension methods > ---------------------------------------------------------- > > Key: GROOVY-10942 > URL: https://issues.apache.org/jira/browse/GROOVY-10942 > Project: Groovy > Issue Type: New Feature > Reporter: Zongle Wang > Priority: Major > > Ref: > https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io.path/java.nio.file.-path/extension.html > https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io.path/java.nio.file.-path/name-without-extension.html -- This message was sent by Atlassian Jira (v8.20.10#820010)