mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add DriverIdentifier
This commit is contained in:
@@ -3201,7 +3201,9 @@ public class CharSequenceUtil extends StrValidator {
|
||||
}
|
||||
|
||||
/**
|
||||
* 截断字符串,使用其按照指定编码为字节后不超过maxBytes长度
|
||||
* 截断字符串,使用其按照指定编码为字节后不超过maxBytes长度<br>
|
||||
* 此方法用于截取总bytes数不超过指定长度,如果字符出没有超出原样输出,如果超出了,则截取掉超出部分,并可选添加...,
|
||||
* 但是添加“...”后总长度也不超过限制长度。
|
||||
*
|
||||
* @param str 原始字符串
|
||||
* @param charset 指定编码
|
||||
|
@@ -321,6 +321,13 @@ public class CharSequenceUtilTest {
|
||||
Assertions.assertEquals(str, ret);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void limitByteLengthUtf8Test2() {
|
||||
final String str = "这是This一";
|
||||
final String ret = StrUtil.limitByteLengthUtf8(str, 12, true);
|
||||
Assertions.assertEquals("这是Thi...", ret);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void limitByteLengthTest() {
|
||||
final String str = "This is English";
|
||||
|
Reference in New Issue
Block a user