Java tutorial
//package com.java2s; public class Main { /** * http://36kr.com/p/5040401.html-->5040401 * @param pStr * @return */ public static String getArticleId(String pStr) { String tempStr = pStr.substring(pStr.lastIndexOf("/") + 1); if (tempStr.contains(".")) { String[] temp = tempStr.split("\\."); // 5040196 return temp[0]; } return pStr; } }