From 2e26ccf33b278ad14b790ee36032c0ea2c904dac Mon Sep 17 00:00:00 2001 From: zhouinfo Date: Tue, 15 Feb 2022 06:53:57 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=B8=AD=E6=96=87=E6=8B=BC?= =?UTF-8?q?=E9=9F=B3=E9=A6=96=E5=AD=97=E6=AF=8D=E7=A9=BA=E6=95=B0=E7=BB=84?= =?UTF-8?q?=E5=88=A4=E6=96=AD=20=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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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..eb0938e8 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,7 +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)); // System.out.println(getFullSpell(str));