Java tutorial
//package com.java2s; public class Main { public static String getTitleId(String pStr) { if (pStr.contains(".")) { String[] temp = pStr.split("\\."); // /p/5040196 int index = temp[0].lastIndexOf("/"); return temp[0].substring(index + 1); } return pStr; } }