From 24681c81c09022f584a57006f2534b5f74723414 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 30 六月 2026 09:27:31 +0800
Subject: [PATCH] 初始化项目
---
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/string/StrUtils.java | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/string/StrUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/string/StrUtils.java
index 47a53a5..f0e423e 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/string/StrUtils.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/string/StrUtils.java
@@ -3,6 +3,7 @@
import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.pinyin.PinyinUtil;
import org.aspectj.lang.JoinPoint;
import java.util.Arrays;
@@ -79,6 +80,25 @@
}
/**
+ * 杞皬鍐欐嫾闊筹紝瀛椾箣闂翠互绌烘牸鍒嗛殧锛屼究浜庤皟鐢ㄦ柟鎸夐渶鎷兼帴 / 鍙栭瀛楁瘝 / 鎷奸煶鎼滅储
+ *
+ * 渚嬶細銆岃�佸紶銆嶁啋 "lao zhang"銆併�孼hangSan銆嶁啋 "zhangsan"
+ * 鑻辨枃 / 鏁板瓧 / 绗﹀彿鍘熸牱杩斿洖锛岀┖鍊艰繑鍥� null
+ *
+ * 娉ㄦ剰锛氬簳灞備緷璧� hutool-extra 鐨� {@link PinyinUtil}锛岄渶瑕佷笟鍔℃ā鍧楄嚜琛屽紩鍏ユ嫾闊冲紩鎿庝緷璧�
+ * 锛坧inyin4j / TinyPinyin / Bopomofo4j 浠婚�夊叾涓�锛夛紝鍚﹀垯杩愯鏃朵細鎶� NoClassDefFoundError
+ *
+ * @param str 瀛楃涓�
+ * @return 鎷奸煶涓诧紙淇濈暀绌烘牸鍒嗛殧锛�
+ */
+ public static String toPinyin(String str) {
+ if (StrUtil.isBlank(str)) {
+ return null;
+ }
+ return PinyinUtil.getPinyin(str);
+ }
+
+ /**
* 鎷兼帴鏂规硶鐨勫弬鏁�
*
* 鐗规畩锛氭帓闄や竴浜涙棤娉曞簭鍒楀寲鐨勫弬鏁帮紝濡� ServletRequest銆丼ervletResponse銆丮ultipartFile
--
Gitblit v1.9.3