Java tutorial
//package com.java2s; public class Main { /** * @brief get base url from a web full address * * @param url [IN] web full address * * @return Return base url */ public static String getBaseUrl(String url) { if (url != null) { String baseURL = url.substring(0, url.lastIndexOf("/") + 1); return baseURL; } return null; } }