标签:pre line isp 正则 size data- play source print
[{columnDisplaySize=8, columnName=WARD_CODE, columnTypeName=varchar}, {columnDisplaySize=11, columnName=BED_NO, columnTypeName=int},[{columnDisplaySize=8, columnName=WARD_CODE, columnTypeName=varchar}, {columnDisplaySize=11, columnName=BED_NO, columnTypeName=int}]]
需要在等号两边的字符串都加上双引号,并将等号转换成冒号,,使其成为标准的JSON字符串.
String str="[{columnDisplaySize=8, columnName=WARD_CODE, columnTypeName=varchar}, {columnDisplaySize=11, columnName=BED_NO, columnTypeName=int}]";
String strS="(\\w+)\\s*=\\s*(\\w+)";
String strresult=str.replaceAll(strS,"\"$1\":\"$2\"");
System.out.println(strresult
标签:pre line isp 正则 size data- play source print
原文地址:http://www.cnblogs.com/smiler/p/7236139.html