调用该方法把字符串转成Map对象。
结果发现怎么都不成功……
这个方法在别的项目里不都是一切顺利吗?!
最后发现split分隔里有空格啊!!
BW自动生成的mapStr是有空格的。
现在从文件读的没有空格噢!!
public static Map mapStringToMap(String str) {
str = str.substring(1, str.length() - 1);
System.out.println("str : "+str);
//String[] strs = str.split(", ");
// note for above space after ,
String[] strs = str.split(",");Mapmap = new HashMap();
for (String string : strs) {
String key = string.split("=")[0];
try {
String value = string.split("=")[1];
System.out.println(" key : "+key +"value sys : "+value);
map.put(key, value);
} catch (Exception e) {
continue;
}
}
return map;
}