首页 > 其他 > 详细

字符串转换

时间:2020-07-28 22:38:26      阅读:78      评论:0      收藏:0      [点我收藏+]

public static void main(String[] args) throws JsonProcessingException {
String resStr = "[{billType=idCard, filePath=IMG003:/data/upload/2020/7/28/00/xxxxxxxxxxxxxxxxx/a_7.jpg}, {billType=autoCard, filePath=IMG003:/data/upload/2020/7/28/00/xxxxxxxxxxxxxxxxx/b_7.jpg}, {billType=autoCard, filePath=IMG003:/data/upload/2020/7/28/00/xxxxxxxxxxxxxxxxx/c_7.jpg}]";
String s = resStr.replaceAll("\\s*", "")
.replaceAll("\\{", "\\{\"")
.replaceAll("=", "\":\"")
.replaceAll("}", "\"\\}")
.replaceAll(",", "\",\"")
.replaceAll("}\",\"\\{", "\\},\\{");
List<ImageVo> imageVos = JSONUtil.toList(JSONUtil.parseArray(s), ImageVo.class);
System.out.println(imageVos);
}

字符串转换

原文:https://www.cnblogs.com/wycBolg/p/13393156.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!