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 clearDirectory(String str) {
        int i = str.lastIndexOf(File.separator);
        if (i != -1) {
            return clearSuffix(str.substring(i + 1, str.length()));
        }
        return str;
    }

    public static String clearSuffix(String str) {
        int i = str.lastIndexOf(".");
        if (i != -1) {
            return str.substring(0, i);
        }
        return str;
    }
}