indexof与lastIndexof的区别和理解

public static void main(String[] args){
    String path = "127.0.0.1:8090/pf?av=1.0.0&v=1.3.2&key=8haGpDUWDTingYunBrowserU&ref=http%3A%2F%2F127.0.0.1%2FPCGetTaskClient%2F&rand=1474791005095&pvid=700f-5be4f2cc&ns=1&f=0&qs=3&rs=119&re=119&os=226&oe=229&oi=226&oc=229&ls=229&le=229&tus=3&tue=6&je=1&id=agentid&a=agent_a&q=agent_q&tid=agenttid&n=agent_n&sh=1080&sw=1921&aid=1054";
    int index = path.lastIndexOf("/");
    int endex = path.indexOf("?");
    System.out.println("index-->"+index);
    System.out.println("endex-->"+endex);
}
运行结果

indexof与lastIndexof的区别和理解_第1张图片

你可能感兴趣的:(java-基础知识)