/** * @param book * @param startRow * @param startCol * @param endRow * @param endCol * @return */ public static String coor2Formula( JBook book, int startRow, int startCol, int endRow, int endCol) { String T1 = null, T2 = null, Text = null; try { T1 = book.formatRCNr(startRow, startCol, false); if (startRow == endRow && startCol == endCol) { Text = T1; } else { T2 = book.formatRCNr(endRow, endCol, false); Text = T1 + ":" + T2; } } catch (Exception e) { e.printStackTrace(); } return Text; }
/** * 解析参数 形式:BBLX:TZ01,BBBH:0110,CS:@CQSM@;@YYYY@2004 * * @param params * @return */ public static Hashtable parseQueryParams(String params) { try { if (params != null && params.length() > 0) { String[] keys = params.split(","); Hashtable map = new Hashtable(); for (int i = 0; i < keys.length; i++) { String crtStr = keys[i]; int index = crtStr.indexOf(":"); String key = crtStr.substring(0, index); // 去除: String value = crtStr.substring(index + 1); map.put(key, value); } return map; } } catch (Exception e) { e.printStackTrace(); } return null; }
/** * 解析参数 * * @param params * @return */ public static Hashtable parseParams(String params) { try { if (params != null && params.length() > 0) { String[] keys = params.split(";"); Hashtable map = new Hashtable(); for (int i = 0; i < keys.length; i++) { String crtStr = keys[i]; int index = crtStr.lastIndexOf("@") + 1; String key = crtStr.substring(1, index - 1); // 去除@ String value = crtStr.substring(index); map.put(key, value); } return map; } } catch (Exception e) { System.out.println("解析参数出现错误:" + params); e.printStackTrace(); } return new Hashtable(); }