Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.text.TextUtils;

public class Main {
    public static String getFilenameWithoutExt(String path) {
        String filename = "";

        if (!TextUtils.isEmpty(path)) {
            int indexOfSlash = path.lastIndexOf('/');
            int indexOfDot = path.lastIndexOf('.');
            if (indexOfDot <= indexOfSlash) {
                indexOfDot = path.length();
            }
            filename = path.substring(indexOfSlash + 1, indexOfDot);
        }

        return filename;
    }
}