去掉String属性的最后一个逗号
文章目录
也可以是其他符号,有这种问题的时候应该考虑先改存储的地方(可以按制定字符串拆分成数组,长度大于1的时候才加分隔符,否则末尾就不用添加了)
Boolean isNotEmpty = StringUtils.isNotBlank(this.version);
Boolean lastIndex = false;
if(isNotEmpty){
lastIndex = ",".equals(this.version.substring(version.length()-1));}
if(isNotEmpty && lastIndex){
return this.version.substring(0,version.length()-1);}else{
return this.version;}
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论