Java tutorial
//package com.java2s; public class Main { public static String getTitle(String url) { int idx = url.lastIndexOf("."); int slant = url.lastIndexOf("/"); if (idx < 0) idx = url.length(); if (slant < 0) slant = 0; String title = url.substring(slant, idx); return title; } }