Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
787d7600
提交
787d7600
authored
5月 15, 2023
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
!479 StrUtils.maxLength会强制给后面加三个点,哪怕长度没有超过,优化长度不超过不加...
上级
a9cda4fd
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
13 行增加
和
4 行删除
+13
-4
SetUtils.java
...oder/yudao/framework/common/util/collection/SetUtils.java
+4
-3
StrUtils.java
.../iocoder/yudao/framework/common/util/string/StrUtils.java
+9
-1
没有找到文件。
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/SetUtils.java
浏览文件 @
787d7600
package
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
collection
;
import
java.util.Arrays
;
import
java.util.HashSet
;
import
cn.hutool.core.collection.CollUtil
;
import
java.util.Set
;
/**
...
...
@@ -11,8 +11,9 @@ import java.util.Set;
*/
public
class
SetUtils
{
@SafeVarargs
public
static
<
T
>
Set
<
T
>
asSet
(
T
...
objs
)
{
return
new
HashSet
<>(
Arrays
.
asList
(
objs
)
);
return
CollUtil
.
newHashSet
(
objs
);
}
}
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/string/StrUtils.java
浏览文件 @
787d7600
package
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
string
;
import
cn.hutool.core.lang.Assert
;
import
cn.hutool.core.util.ArrayUtil
;
import
cn.hutool.core.util.StrUtil
;
...
...
@@ -13,7 +14,14 @@ import java.util.Collection;
public
class
StrUtils
{
public
static
String
maxLength
(
CharSequence
str
,
int
maxLength
)
{
return
StrUtil
.
maxLength
(
str
,
maxLength
-
3
);
// -3 的原因,是该方法会补充 ... 恰好
Assert
.
isTrue
(
maxLength
>
0
);
if
(
null
==
str
)
{
return
null
;
}
if
(
str
.
length
()
<=
maxLength
)
{
return
str
.
toString
();
}
return
StrUtil
.
sub
(
str
,
0
,
maxLength
-
3
)
+
"..."
;
// -3 的原因,是该方法会补充 ... 恰好
}
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论