/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package asistencia.utilities;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 * @author sistem08user
 */
public class GeneralUtils {

	public static int obtenerIndex(String ruta) {
		char[] c = ruta.toCharArray();
		int salida = 0;
		for (int i = c.length - 1; i >= 0; i--) {
			String help = c[i] + "";
			if (!help.equals("/")) {
				salida = i;
			} else {
				break;
			}
		}
		return salida;
	}

	public static String obtenerURIvista(String ruta) {
		String rutaVista = "";
		String patron = ".*/vistas/(.*)";
		Pattern pattern = Pattern.compile(patron);
		Matcher matcher = pattern.matcher(ruta);

		if (matcher.find()) {
			rutaVista = matcher.group(1);
		}
		return rutaVista;
	}
}
