Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;

public class Main {

    public static String getSimpleName(String fileName) {
        String str = fileName;
        if (str == null) {
            return null;
        }
        if (str.lastIndexOf(File.separator) >= 0) {
            str = str.substring(str.lastIndexOf(File.separator) + 1);
        }
        if (str.indexOf(".") >= 0) {
            str = str.substring(0, str.lastIndexOf("."));
        }

        return str;
    }
}