mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-04 20:58:00 +08:00
fux bug
This commit is contained in:
parent
24569b81c8
commit
f8017c31d5
@ -21,6 +21,7 @@
|
|||||||
* 【core 】 修复CsvParser行号有误问题(pr#2065@Github)
|
* 【core 】 修复CsvParser行号有误问题(pr#2065@Github)
|
||||||
* 【http 】 修复HttpRequest.of无法自动添加http前缀问题(issue#I4PEYL@Gitee)
|
* 【http 】 修复HttpRequest.of无法自动添加http前缀问题(issue#I4PEYL@Gitee)
|
||||||
* 【core 】 修复 `CharSequenceUtil.brief(str, maxLength)` 方法字符串越界问题,以及 `maxLength` 部分值时结果与预期不符的问题(pr#2068@Github)
|
* 【core 】 修复 `CharSequenceUtil.brief(str, maxLength)` 方法字符串越界问题,以及 `maxLength` 部分值时结果与预期不符的问题(pr#2068@Github)
|
||||||
|
* 【core 】 修复NamingCase中转换下划线字母+数字转换问题(issue#2070@Github)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.7.18 (2021-12-25)
|
# 5.7.18 (2021-12-25)
|
||||||
|
@ -90,7 +90,7 @@ public class NamingCase {
|
|||||||
} else if (Character.isLowerCase(preChar)) {
|
} else if (Character.isLowerCase(preChar)) {
|
||||||
// 前一个为小写
|
// 前一个为小写
|
||||||
sb.append(symbol);
|
sb.append(symbol);
|
||||||
if (null == nextChar || Character.isLowerCase(nextChar)) {
|
if (null == nextChar || Character.isLowerCase(nextChar) || CharUtil.isNumber(nextChar)) {
|
||||||
//普通首字母大写,如aBcc -> a_bcc
|
//普通首字母大写,如aBcc -> a_bcc
|
||||||
c = Character.toLowerCase(c);
|
c = Character.toLowerCase(c);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package cn.hutool.core.text;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Dict;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class NamingCaseTest {
|
||||||
|
@Test
|
||||||
|
public void toUnderlineCaseTest(){
|
||||||
|
// https://github.com/dromara/hutool/issues/2070
|
||||||
|
Dict.create()
|
||||||
|
.set("customerNickV2", "customer_nick_v2")
|
||||||
|
.forEach((key, value) -> Assert.assertEquals(value, NamingCase.toUnderlineCase(key)));
|
||||||
|
}
|
||||||
|
}
|
@ -421,12 +421,6 @@ public class StrUtilTest {
|
|||||||
.set("HelloWorld_test", "hello_world_test")
|
.set("HelloWorld_test", "hello_world_test")
|
||||||
.set("H2", "H2")
|
.set("H2", "H2")
|
||||||
.set("H#case", "H#case")
|
.set("H#case", "H#case")
|
||||||
.forEach((key, value) -> Assert.assertEquals(value, StrUtil.toUnderlineCase(key)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void toUnderLineCaseTest2() {
|
|
||||||
Dict.create()
|
|
||||||
.set("PNLabel", "PN_label")
|
.set("PNLabel", "PN_label")
|
||||||
.forEach((key, value) -> Assert.assertEquals(value, StrUtil.toUnderlineCase(key)));
|
.forEach((key, value) -> Assert.assertEquals(value, StrUtil.toUnderlineCase(key)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user