From 3719e62fb6ce0a201305f9de6654f5a83bc7db4a Mon Sep 17 00:00:00 2001 From: thinkgem Date: Tue, 15 Feb 2022 15:18:21 +0800 Subject: [PATCH] =?UTF-8?q?!23=20=E4=BF=AE=E6=AD=A3=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E6=8B=BC=E9=9F=B3=E9=A6=96=E5=AD=97=E6=AF=8D=E7=A9=BA=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E5=88=A4=E6=96=AD=E5=AD=97=E7=AC=A6=E4=B8=B2=E4=B8=8D?= =?UTF-8?q?=E6=98=AF=E4=B8=AD=E6=96=87=E5=AD=97=E7=AC=A6,=E4=BC=9A?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E7=A9=BA=E6=95=B0=E7=BB=84,=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/src/main/java/com/jeesite/common/text/PinyinUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/jeesite/common/text/PinyinUtils.java b/common/src/main/java/com/jeesite/common/text/PinyinUtils.java index 660ba556..af680add 100644 --- a/common/src/main/java/com/jeesite/common/text/PinyinUtils.java +++ b/common/src/main/java/com/jeesite/common/text/PinyinUtils.java @@ -52,7 +52,7 @@ public class PinyinUtils { if (arr[i] > 128) { try { String[] temp = PinyinHelper.toHanyuPinyinStringArray(arr[i], Static.defaultFormat); - if (temp != null) { + if (temp != null && temp.length > 0) { pybf.append(temp[0].charAt(0)); }else{ pybf.append(String.valueOf(arr[i])); @@ -155,6 +155,7 @@ public class PinyinUtils { } // public static void main(String[] args) { +// String str = "你好,123,🅻🅾🆅🅴、世界abc,~!#$_Sdf,女;hello!-"; // String str = "你好,123,世界abc,~!#$_Sdf,女;hello!-"; // System.out.println(getFirstSpell(str)); // System.out.println(getFirstSpell(str, false));