get Extension name from a path - Android java.io

Android examples for java.io:File Path

Description

get Extension name from a path

Demo Code

import android.location.Location;
import java.math.BigDecimal;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DecimalFormat;
import java.text.NumberFormat;

public class Main{

    public static String getExtension(String s) {
        int dot = s.lastIndexOf(".");
        return s.substring(dot + 1);
    }/*from   ww  w.j a va 2 s .  co  m*/

}

Related Tutorials