zoukankan      html  css  js  c++  java
  • Android 获取Web地址栏参数

    String url = entity.getTPXW_ImgUrl().toString();
                    String[] parameters = { "ClassID" };
                    String u;
                    try {
                        u = URLDecoder.decode(url, "UTF-8");
                        String[] strLength = new String[0];
                        int strSplit1 = 0;
                        int strSplit2 = 0;
                        String strValue = "";
                        for (String s : parameters) {
                            if (u.indexOf(s) != -1) {
                                strLength = (u.substring(u.indexOf(s))).split("&");
                            }
                            for (int j = 0; j < strLength.length; j++) {
                                strValue += strLength[j];
                            }
                        }
                        if (strLength.length <= 0) {
                            strLength = null;
                        } else {
                            strSplit1 = strValue.indexOf("NewsID=");
                            String value1 = strValue.substring(8, strSplit1);
                            strSplit2 = strValue.lastIndexOf("=");
                            String value2 = strValue.substring(strSplit2 + 1,
                                    strValue.length());
                            entity.setTPXW_ClassID(Integer.parseInt(value1));
                            entity.setTPXW_NewsID(Integer.parseInt(value2));
                        }
                    } catch (UnsupportedEncodingException e) {
                        e.printStackTrace();
                    }
  • 相关阅读:
    chess「dp」
    e[树上主席树]
    d[贪心]
    神盐皇
    LA 8043. ACM-ICPC World Finals 2017 E. Need for Speed
    八数码问题
    UVa 679. Dropping Balls
    关于时间复杂度
    欧拉序列 (Euler Tour)
    莫队算法
  • 原文地址:https://www.cnblogs.com/xiaoyao095/p/4444998.html
Copyright © 2011-2022 走看看