CharSequenceUtil增加toLoweCase和toUpperCase方法(issue#IC0H2B@Gitee)

This commit is contained in:
Looly 2025-04-11 19:13:40 +08:00
parent e8e340d9eb
commit d5d81bdd15
2 changed files with 37 additions and 0 deletions

View File

@ -8,6 +8,7 @@
* 【core 】 `PathUtil#del`增加null检查pr#1331@Gitee
* 【db 】 增加SAP HANA识别及方言pr#3914@Github
* 【crypto 】 增加`Argon2`实现Argon2算法issue#3890@Github
* 【core 】 `CharSequenceUtil`增加toLoweCase和toUpperCase方法issue#IC0H2B@Gitee
### 🐞Bug修复

View File

@ -4237,6 +4237,42 @@ public class CharSequenceUtil {
// ------------------------------------------------------------------------ lower and upper
/**
* 将字符串转为小写
*
* @param str 被转的字符串
* @return 转换后的字符串
* @see String#toLowerCase()
* @since 5.8.38
*/
public static String toLoweCase(final CharSequence str) {
if (null == str) {
return null;
}
if(0 == str.length()){
return EMPTY;
}
return str.toString().toLowerCase();
}
/**
* 将字符串转为大写
*
* @param str 被转的字符串
* @return 转换后的字符串
* @see String#toUpperCase()
* @since 5.8.38
*/
public static String toUpperCase(final CharSequence str) {
if (null == str) {
return null;
}
if(0 == str.length()){
return EMPTY;
}
return str.toString().toUpperCase();
}
/**
* 原字符串首字母大写并在其首部添加指定字符串 例如str=name, preString=get = return getName
*