Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**
     * Ensures that a filename never ends with the file name extension ".xml"
     * @param name
     * @return
     */
    public static String getFileNameWithoutExtension(String name) {
        if (name.endsWith(".xml") || name.endsWith(".txt")) {
            name = name.substring(0, name.length() - 4);
        }
        return name;
    }
}