Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;

public class Main {
    /**
     * Devuelve el nombre lindo de una pagina a partir
     * del path de la pagina (preferentemente el absoluto)
     * Ej: "MiPaginaConNombreLindo"
     */
    public static String getPageNiceName(String path) {
        File original = new File(path);
        String pageName = original.getName();
        pageName = pageName.substring(0, pageName.indexOf("."));
        return capitalize(pageName);
    }

    public static String capitalize(String str) {
        return (str == null || str.length() == 0) ? "" : Character.toUpperCase(str.charAt(0)) + str.substring(1);
    }

    public static String toUpperCase(String str) {
        return str.toUpperCase();
    }
}