MCPcopy Create free account
hub / github.com/antlr/codebuff / getNameWithoutExtension

Method getNameWithoutExtension

corpus/java/training/guava/io/Files.java:771–776  ·  view source on GitHub ↗

Returns the file name without its file extension or path. This is similar to the basename unix command. The result does not include the '.'. @param file The name of the file to trim the extension from. This can be either

(String file)

Source from the content-addressed store, hash-verified

769 * @since 14.0
770 */
771 public static String getNameWithoutExtension(String file) {
772 checkNotNull(file);
773 String fileName = new File(file).getName();
774 int dotIndex = fileName.lastIndexOf('.');
775 return (dotIndex == -1) ? fileName : fileName.substring(0, dotIndex);
776 }
777
778 /**
779 * Returns a {@link TreeTraverser} instance for {@link File} trees.

Callers

nothing calls this directly

Calls 3

checkNotNullMethod · 0.45
getNameMethod · 0.45
lastIndexOfMethod · 0.45

Tested by

no test coverage detected