Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * Returns the extension of a given filename (excluding the .). If there is
     * no extension defined, this function returns "".
     * 
     * @param path
     * @return
     */
    public static String getExtension(final String path) {
        final int dotPos = path.lastIndexOf(".");
        if (dotPos > 0) {
            return path.substring(dotPos + 1);
        }
        return "";
    }
}