Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static String getFileNameWithouExtAndNumber(String filename) {
        filename = getFileNameWithoutExt(filename);
        if (filename.contains("-")) {
            return filename.substring(filename.indexOf("-") + 1, filename.length());
        }
        return filename;
    }

    public static String getFileNameWithoutExt(String filename) {
        if (filename.lastIndexOf(".") != -1 && filename.lastIndexOf(".") != filename.length() - 1) {
            return filename.substring(0, filename.lastIndexOf("."));
        }
        return filename;

    }
}