MCPcopy
hub / github.com/google/guava / getNameWithoutExtension

Method getNameWithoutExtension

guava/src/com/google/common/io/Files.java:812–817  ·  view source on GitHub ↗

Returns the file name without its <a href="http://en.wikipedia.org/wiki/Filename_extension">file extension</a> or path. This is similar to the {@code basename} unix command. The result does not include the '{@code .}'. @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

810 * @since 14.0
811 */
812 public static String getNameWithoutExtension(String file) {
813 checkNotNull(file);
814 String fileName = new File(file).getName();
815 int dotIndex = fileName.lastIndexOf('.');
816 return (dotIndex == -1) ? fileName : fileName.substring(0, dotIndex);
817 }
818
819 /**
820 * Returns a {@link Traverser} instance for the file and directory tree. The returned traverser

Callers 1

Calls 3

checkNotNullMethod · 0.45
getNameMethod · 0.45
lastIndexOfMethod · 0.45

Tested by 1