小弟有如下一组数据,字符格式的.
如何把他们转成Map对象,经验不足.还望指教
trans_state = 01,
dc_mark = 01,
amount = 10,
trans_date = 20150312,
acc_check_date = 20150312,
balance = 755,
amt_type = 01,
trans_time = 170158,
order_id = OD201521200000002,
trans_type = 03,
order_date = 20150312 |
trans_state = 01,
dc_mark = 01,
amount = 1,
trans_date = 20150312,
acc_check_date = 20150312,
balance = 765,
amt_type = 01,
trans_time = 160631,
order_id = OD201521200000001,
trans_type = 03,
order_date = 20150312 |
trans_state = 01,
dc_mark = 01,
amount = 4,
trans_date = 20150312,
acc_check_date = 20150312,
balance = 766,
amt_type = 01,
trans_time = 143756,
order_id = OD201521200000023,
trans_type = 03,
order_date = 20150312
------解决思路----------------------
代码自己写,有问题可以问
定义一个Instance 类,属性就是trans_state,dc_mark,... order_date 这些
你上面不是已经按照
------解决思路----------------------
分隔一次了嘛,分隔后有数组,遍历这个数组
对数组中的每一项继续按照 , 分隔,分隔后将里面的数组再次按照 = 分隔
然后根据属性名和属性值的关系,将数据组装到对象里面去
将对象放入map中就可以了