Java tutorial
//package com.java2s; public class Main { public static String getHttpReqPath(String str) { int index = str.indexOf("?"); if (index > -1) { str = str.substring(0, index); } index = str.indexOf("#"); if (index > -1) { str = str.substring(0, index); } return str; } }