mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
CharSequenceUtil
增加toLoweCase和toUpperCase方法(issue#IC0H2B@Gitee)
This commit is contained in:
parent
a0eab6fb11
commit
c7c4457deb
@ -3673,13 +3673,26 @@ public class CharSequenceUtil extends StrValidator {
|
||||
* @since 5.8.38
|
||||
*/
|
||||
public static String toLoweCase(final CharSequence str) {
|
||||
return toLoweCase(str, Locale.getDefault());
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串转为小写
|
||||
*
|
||||
* @param str 被转的字符串
|
||||
* @param locale Locale
|
||||
* @return 转换后的字符串
|
||||
* @see String#toLowerCase()
|
||||
* @since 6.0.0
|
||||
*/
|
||||
public static String toLoweCase(final CharSequence str, final Locale locale) {
|
||||
if (null == str) {
|
||||
return null;
|
||||
}
|
||||
if(0 == str.length()){
|
||||
return EMPTY;
|
||||
}
|
||||
return str.toString().toLowerCase();
|
||||
return str.toString().toLowerCase(locale);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3691,6 +3704,19 @@ public class CharSequenceUtil extends StrValidator {
|
||||
* @since 5.8.38
|
||||
*/
|
||||
public static String toUpperCase(final CharSequence str) {
|
||||
return toUpperCase(str, Locale.getDefault());
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串转为大写
|
||||
*
|
||||
* @param str 被转的字符串
|
||||
* @param locale Locale
|
||||
* @return 转换后的字符串
|
||||
* @see String#toUpperCase()
|
||||
* @since 6.0.0
|
||||
*/
|
||||
public static String toUpperCase(final CharSequence str, final Locale locale) {
|
||||
if (null == str) {
|
||||
return null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user