记录-boot项目校验字符串
1、用 Apache Commons Lang 3 依赖中的StringUtils.isBlank(CharSequence cs)
StringUtils.isBlank(CharSequence cs) 用来判断字符串是否为空、为 null 或者只包含空格
引入依赖
<!-- Apache Commons Lang3工具--> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.12.0</version> </dependency>2、用 Spring 自带的工具类 StringUtils.hasText(String str)
StringUtils.hasText(String str):是否包含真正的文本内容。如果字符串是null、""或者全都是空格,返回false
