[6.0.0]
[删除获取中文拼音首字母]
This commit is contained in:
Binary file not shown.
@@ -1,7 +1,5 @@
|
||||
package com.mogo.och.common.module.utils;
|
||||
|
||||
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/11/26
|
||||
@@ -13,19 +11,6 @@ public class PinYinUtil {
|
||||
* @return 大写首字母缩写的字符串
|
||||
*/
|
||||
public static String getPinYinHeadChar(String str) {
|
||||
str = str.replaceAll("[\\p{P}‘’“”|+=¥$<>^~~]", "");
|
||||
StringBuilder convert = new StringBuilder();
|
||||
for (int j = 0; j < str.length(); j++) {
|
||||
char word = str.charAt(j);
|
||||
String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word);
|
||||
if (pinyinArray != null) {
|
||||
convert.append(pinyinArray[0].charAt(0));
|
||||
} else {
|
||||
if (!"".equals(String.valueOf(word).trim())){
|
||||
convert.append(word);
|
||||
}
|
||||
}
|
||||
}
|
||||
return convert.toString().trim().toUpperCase();
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user