记录-boot项目校验字符串

📅 2026/8/15 13:44:04
记录-boot项目校验字符串
1、用 Apache Commons Lang 3 依赖中的StringUtils.isBlank(CharSequence cs)StringUtils.isBlank(CharSequence cs) 用来判断字符串是否为空、为 null 或者只包含空格引入依赖!-- Apache Commons Lang3工具-- dependency groupIdorg.apache.commons/groupId artifactIdcommons-lang3/artifactId version3.12.0/version /dependency2、用 Spring 自带的工具类 StringUtils.hasText(String str)StringUtils.hasText(String str)是否包含真正的文本内容。如果字符串是null、或者全都是空格返回false3、汇总