Properties proper = new Properties(); proper.load(new StringReader(config)); //把字符串转为reader Enumeration enum1 = proper.propertyNames(); while (enum1.hasMoreElements()) { String strKey = (String) enum1.nextElement(); String strValue = proper.getProperty(strKey); map.put(strKey, Integer.valueOf(strValue)); }
字符串示例 :
A=1
B=2
C=3