k94314517
2023-09-11 95957395c7665c251ecf7f8bb24d95edfe826314
server/service/src/main/java/com/doumee/core/utils/PinYinUtil.java
@@ -81,6 +81,7 @@
    * @return 汉语拼音首字母
    */
   public static String getFirstSpell(String chinese) {
      try {
      StringBuffer pybf = new StringBuffer();
      char[] arr = chinese.toCharArray();
      HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
@@ -104,6 +105,11 @@
         }
      }
      return pybf.toString().replaceAll("\\W", "").trim();
      }catch (Exception e){
      }
      return  null;
   }
   /**
    * 获取汉字串拼音首字母,英文字符不变
@@ -150,6 +156,7 @@
    * @return 汉语拼音
    */
   public static String getFullSpell(String chinese) {
      try {
      StringBuffer pybf = new StringBuffer();
      char[] arr = chinese.toCharArray();
      HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
@@ -170,5 +177,9 @@
         }
      }
      return pybf.toString();
      }catch (Exception e){
      }
      return  null;
   }
}