Android File Extension Name Get getExtension(File file)

Here you can find the source of getExtension(File file)

Description

get Extension

Declaration

public static String getExtension(File file) 

Method Source Code

//package com.java2s;

import java.io.File;

public class Main {
    public static String getExtension(File file) {

        int startIndex = file.getName().lastIndexOf(46) + 1;
        int endIndex = file.getName().length();

        return file.getName().substring(startIndex, endIndex);
    }//ww w. java 2 s  .  c  o m
}

Related

  1. changeExtension(File file, String extensionNew)
  2. getExtension(File file)
  3. getExtension(File file, boolean useFirstPeriod, boolean includePeriod)
  4. getExtension(String file)
  5. getExtension(String filename)
  6. getExtensionName(String fileName)