Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * Returns a copy of the given path with the extension omitted.
     *
     * @param path the path
     * @return path, with the extension elements omitted.
     */
    public static String trimOffExtension(String path) {
        int lastSlash = path.lastIndexOf('/');
        int lastDot = path.lastIndexOf('.');
        return (lastDot > lastSlash) ? path.substring(0, lastDot) : path;
    }
}