update
This commit is contained in:
@@ -25,6 +25,7 @@ import java.util.zip.GZIPOutputStream;
|
|||||||
|
|
||||||
import com.hankcs.hanlp.HanLP;
|
import com.hankcs.hanlp.HanLP;
|
||||||
import com.hankcs.hanlp.dictionary.py.Pinyin;
|
import com.hankcs.hanlp.dictionary.py.Pinyin;
|
||||||
|
import com.sun.javafx.scene.transform.TransformUtils;
|
||||||
import net.sf.json.JSON;
|
import net.sf.json.JSON;
|
||||||
import net.sf.json.JSONArray;
|
import net.sf.json.JSONArray;
|
||||||
import net.sf.json.JSONNull;
|
import net.sf.json.JSONNull;
|
||||||
@@ -1827,18 +1828,23 @@ public class DataUtil {
|
|||||||
public static boolean isChineseChar(String c) {
|
public static boolean isChineseChar(String c) {
|
||||||
if (StringUtils.isNotBlank(c)) {
|
if (StringUtils.isNotBlank(c)) {
|
||||||
String temp = String.valueOf(c);
|
String temp = String.valueOf(c);
|
||||||
Pattern pattern = Pattern.compile("[\\u4e00-\\u9fa5]+");
|
Pattern pattern = Pattern.compile("[\\u4e00-\\u9fa5\\w]+");
|
||||||
Matcher matcher = pattern.matcher(temp);
|
Matcher matcher = pattern.matcher(temp);
|
||||||
return matcher.matches();
|
return matcher.matches();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
System.out.println(getFirstChar("文裕花园"));
|
|
||||||
System.out.println(getFirstChar("文怡花园"));
|
|
||||||
|
|
||||||
System.out.println(FourUpSixInto("258.393", 2));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println(isChineseChar("6文怡a花园"));
|
||||||
|
// System.out.println(getFirstChar("文怡花园"));
|
||||||
|
//
|
||||||
|
// System.out.println(FourUpSixInto("258.393", 2));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -181,8 +181,9 @@ public class SaleLeadsController {
|
|||||||
Method m = saleLeads.getClass().getMethod("get"+fildName);
|
Method m = saleLeads.getClass().getMethod("get"+fildName);
|
||||||
String value = (String)m.invoke(saleLeads);
|
String value = (String)m.invoke(saleLeads);
|
||||||
if(StringUtils.isNotBlank(value)){
|
if(StringUtils.isNotBlank(value)){
|
||||||
if(!DataUtil.isChineseChar(value)){
|
String s1 = value.replaceAll("\\pP|\\pS", "");
|
||||||
String newValue = new String(value.getBytes("ISO8859-1"), "UTF-8");
|
if(!DataUtil.isChineseChar(s1)){
|
||||||
|
String newValue = new String(value.getBytes("ISO8859-1"), "UTF-8");
|
||||||
m = saleLeads.getClass().getMethod("set"+fildName,String.class);
|
m = saleLeads.getClass().getMethod("set"+fildName,String.class);
|
||||||
m.invoke(saleLeads, newValue);
|
m.invoke(saleLeads, newValue);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user