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 getResouceTitle(String filename) {
        if (filename.contains("-")) {
            return getFileNameWithoutExt(filename).split("-")[1];
        }
        return getFileNameWithoutExt(filename);
    }

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

    }
}